Change the directory. You can either give a full path or simply a series of child-directories.
Use: cd /path/to/folder
View what child-directories and files there are in the current working directory. On some operating systems they might be color-coded as well.
Shows the absolute path to your current working directory.
Prints a list of files matching your input. If you type a full file name it will either show that file-name or an error message stating that the file was not found.
It is particularly useful when combined with the *-operator for pattern matching.
Use: find <file_name>
Print the size of the directory you give as an argument.
Use: du -sh <directory_name>
Move or rename files.
Use: mv <old_name/location> <new_name/location>
Copy files from <old_location> to <new_location>.
Use: cp <old_location> <new_location>
Delete a file. named <file_name>. Be careful with this, especially when using it in combination with the *-operator or with the -r flag!
Use: rm <file_name>
View the content of a file by displaying it on the Terminal. It is meant for test-files only, so you might get weird results when trying to view for instance an image.
Use: cat <file_name>
Create an empty file, named <file_name>
Use: touch <file_name>
Create a directory called <dir_name>
Use: mkdir <dir_name>
Grep is a very powerful command, but put simply searches for string-parts in a document. One of the more useful ways of using it, is directly piping the output of some command to it.
Example: Find <text> in a text-file called <file> cat <file>
The star operator is used for pattern matching. The star operator can be viewed as a joker, that can be replaced by any string, even an empty one. It is useful for auto-completion or accessing multiple files that have similar names.
Example: cat *.txt will print out any text-file using the file extension .txt to your terminal.
View the manual page of any command that comes with a manual page. (Most commands do have one) On this page you will be shown the usage and all the options the command provides.
Use: man <command>
Shows a list of running processes and used system resources. To quit it, press q or Ctrl + C. Especially useful for finding Process-IDs.
Shows a colorful and dynamic almost graphical) interface of the top command. It has a more readable layout and allows to kill processes by selecting them. Also allows sorting the processes by different metrics.
Sends a stop-flag to the process given by the process-ID. You can choose between different flags. The graceful way (i.e. the one to try first) is to write
kill -6 <process-ID>
It allows the killed program to handle the exit and to some last minute store.
If this does not work, one can also use the more aggressive flag
kill -9 <process-ID>
Displays the amount of system memory in use and how much is still free. To display it in a human readable way (i.e. in GB or MB rather than Bytes), use the -h flag.
Use: free -h
Executes the following command every 2s and updates the screen. This command is useful to monitor the behavior of some statistics.
One can also decrease the time between updates by using the -n flag.
Use: watch -n <time_between_updates> <command>
Example: watch -n 0.2 free -h (displays the free memory every 0.2 seconds)
If a Nvidia graphics card is installed this command shows important information about the current status of the graphics card.
Provides an environment, in which you can emulate a console. You can safely detach from this environment and it will keep being executed. You can than reconnect at any point and it will show you the contents of the terminal at that point in time.
It is especially useful when working on the cluster, as you can have your virtual environment running in one screen and detach from this screen and disconnect from the server, without the process being killed. (If you don’t run your script through slurm)
One downside of this environment is however, that you cannot easily scroll within it.
|&-operator||Execute a command in the background. This will have your terminal run the command without occupying the screen. (i.e. you can still interact with the terminal as normal)|