Bash Commands
In the table below command arguments are described as <arg-info>, key presses are described by [key] and key combinations are described by [key-1]+[key-2]
| Command | Name | Description |
exit
|
Exit Bash Session | terminate the current bash session. - closes the window if this is the outermost session layer |
man
|
Manual |
show the manual entry for the specified command - once the manual entry opens, press q to quit- to navigate use up-arrow/down-arrow and page-up/page-down |
ls
|
List |
lists directory contents - use ls -l for a list with file properties- use ls -a to show hidden files- use ls -orth for a time-sorted list with the most recent filesat the bottom of the list and clear file sizes (good for listing downloads) |
pwd
|
Print Working Directory | prints the full file path of your current directory location |
cd <directory>
|
Change Directory |
move into the target directory - use cd .. to move up one directory- all files and directories are case sensitive - for names with spaces in them, use double quotes: cd "My Folder"
|
cat <target-file>
|
Concatenate |
write the contents of the target file to terminal output
- multiple files can be listed with space separations and the output will be joined (concatenated) - output can be remapped with > to create a new file |
clear
|
Clear Terminal |
removes all terminal output from visibility
- does not command erase history |
history
|
Command History | shows a list of all recent bash commands for this user |
mv <original-file> <final-file>
|
Move (also rename) |
relocate the specified file - both original and final file can contain path information - if final file is a directory name original is moved inside the directory - if final file is not a directory the original is renamed - if the final file name exists already it will be erased and replaced when the orignal is renamed |
cp <original-file> <final-file>
|
Copy to new file |
copy the specified file - both original and final file can contain path information - if final file is a directory name, original is coppied inside the directory - if final file is not a directory the copy will be renamed - if the final file name exists already it will be erased and replaced by the new copy |
rm <target-file>
|
Remove |
delete the target file - use rm -r to remove a directory and all of its contents
|
mkdir <name>
|
Make Directory | creates a directory with the specified name |
nano <file-name>
|
Nano Text Editor |
open nano text editor to begin reading and editing the specified file - hotkeys are listed at the bottom. Ctrl + X exits - if the file does not exist you can create it with Ctrl + O |
gcc -o <program-name> <source-file>.c
|
GNU C Compiler |
Attempt to compile target <source-file>.c and create an executable binary with <program-name> Source files names must end in '.c' . The program name should have no file name extension in Linux or '.exe' in Windows. Do not name the output <program-name> the same as the source file or it will overwrite (delete) your source code! If the command executes with no output, compiling is typically successful. If errors are output, no program will be created. |