

Source activates the changes in ~/.bash_profile for the current session. Standard error, abbreviated as stderr, is an error message outputted by a failed process.

Sort takes a filename or standard input and orders each line alphabetically, printing it to standard output. rain: the replacement string, the text to add in place.snow: the search string, the text to find.It accepts standard input and modifies it based on an expression, before displaying it as output data. Rm -r deletes a directory and all of its child directories. Here we remove the file waterboy.txt from the file system. Pwd prints the name of the working directory rm $ rm waterboy.txt PATH lists which directories contain scripts. Each directory contains scripts for the command line to execute. PATH is an environment variable that stores a list of directories separated by a colon. It works just like a desktop text editor like TextEdit or Notepad, except that it is accessible from the command line and only accepts keyboard input. Here we move superman.txt into superhero/. To move a file into a directory, use mv with the source file as the first argument and the destination directory as the second argument. Here we used mkdir to create a new directory named media/. Mkdir takes in a directory name as an argument, and then creates a new directory in the current working directory. Ls -t orders files and directories by the time they were last modified. Ls -l lists all contents of a directory in long format. Ls -a lists all contents in the working directory, including hidden files and directories ls -l $ ls -lĭrwxr-xr-x 5 cc eng 4096 Jun 24 16:51 actionĭrwxr-xr-x 4 cc eng 4096 Jun 24 16:51 comedyĭrwxr-xr-x 6 cc eng 4096 Jun 24 16:51 drama preferences action drama comedy genres.xt Ls lists all files and directories in the working directory ls -a $ ls -a The HOME variable is an environment variable that displays the path of the home directory. R stands for “recursive” and l stands for “files with matches”. Grep -Rl searches all files in a directory and outputs only filenames with matched results. grep -Rl $ grep -Rl Arctic /home/ccuser/workspace/geography Grep -R searches all files in a directory and outputs filenames and lines containing matched results. grep -R $ grep -R Arctic /home/ccuser/workspace/geography Grep -i enables the command to be case insensitive. It searches files for lines that match a pattern and returns the results. Grep stands for “global regular expression print”. This is a way to make the variable persist across programs. export export USER="Jane Doe"Įxport makes the variable to be available to all child sessions initiated from the session you are in.

envĮnv | grep PATH is a command that displays the value of a single environment variable.

Here, m*.txt selects all files in the working directory starting with “m” and ending with “.txt”, and copies them to scifi/. There are other types of wildcards, too, which are beyond the scope of this glossary. The above example will copy all of the files in the current directory to the directory called satire. The wildcard * selects all of the files in the current directory. Here, we copy the file ada_lovelace.txt and place it in the historical/ directory Wildcards (*) $ cp * satire/ cp $ cp ada_lovelace.txt historical/Ĭp copies files or directories. Here, cd jan/memory/ command navigates directly to the jan/memory directory. To navigate directly to a directory, use cd with the directory’s path as an argument. cd $ cd Desktop/Ĭd takes a directory name as an argument, and switches into that directory. The alias command allows you to create keyboard shortcuts, or aliases, for commonly used commands. When a session starts, it will load the contents of the bash profile before executing commands. It is commonly called the “bash profile”. ~/.bash_profile is the name of file used to store environment settings. You can think of this as “command to command” redirection. The | takes the standard output of the command on the left, and pipes it as standard input to the command on the right.
