The Terminal Flashcards
Lists files in current directory… or a directory specified
ls
ls FOLDER_NAME
Change Directory (literally)
You start out in your “~” (home) directory and use this to move to a different one
cd FOLDER_NAME
Make Directory (literally)
Create a directory folder
mkdir FOLDER_NAME
Remove (literally)/Delete
Delete/Remove a file or a directory.
If you try it on a file, you must add this as a parameter.
WARNING: Action is permanent
rm FOLDER_NAME
rm -r FOLDER_NAME
Move (literally)/Rename
Move a file or a directory.
It also serves as the way to rename a file to another name.
mv OLD_NAME
NEW_NAME
Manual (literally)
Type this along with another command and (usually) a page will appear telling you how to use that command.
It is, as the name implies, a manual page that is a quick resource for help.
Press “q” to quit when open.
man COMMAND_NAME
Examples:
- man ls
- man gcc
Difference (literally)
Will tell you the difference between two files.
If there is no difference, nothing is printed out.
diff FILE1 FILE2
Nano (literally) Text Editor
Dr. Marz’s preferred Terminal Text Editor.
Commands are shown at the bottom of the screen (e.g. Ctrl+X = Exit)
nano FILE
Vim (literally) Text Editor
Writer’s preferred “(and clearly superior)” text editor
vi FILE
vim FILE
Gedit (literally) Text Editor
This one actually isn’t a terminal application. It will execute a graphical text editor kind of like TextEdit on Mac and Notepad on Windows.
You cannot use your terminal while Gedit is open.
gedit FILE
A C++ Compiler
You will be using this for pretty much your entire time here.
It will make an executable from your C++ source code files.
g++ -o EXECUTABLE SOURCE
Examples:
- g++ -o test test.cpp
Secure Shell
Allows you to remotely connect to other machines.
i.e., connect to UTK’s Hydra machines from your personal computer.
ssh USERNAME@ADDRESS
Examples:
- ssh cnguyen@hydra0.eecs.utk.edu
Description:
Writes a file to the disk.
Command:
:w
Description:
Quits Vim. If you made changes to a file, you must put “!” after in order to quit without saving changes. Otherwise it’ll refuse to quit.
Command:
:q
:q!
Description:
Writes to disk, and then Quits Vim.
Command:
:wq
Description:
Triggers Insert Mode
Command:
i
Description:
Triggers Visual Mode
Command:
v
Description:
Triggers Visual Block Mode
Command:
V