UNIX cheatsheet#
This Unix commands cheat sheet summarizes a few basic commands you will need during the tutorial.
Command | Description | Options | Examples |
---|---|---|---|
ls | List files and directories. | -l: Long format listing. -a: Include hidden files. |
ls -l displays files and directories with detailed information. ls -a shows all files and directories, including hidden ones. |
cd | Change directory. | N/A | cd /path/to/directory changes the current directory to the specified path. |
pwd | Print current working directory. | N/A | pwd displays the current working directory. |
mkdir | Create a new directory. | N/A | mkdir my_directory creates a new directory named "my_directory". |
rm | Remove files and directories. | -r: Remove directories recursively. -f: Force removal without confirmation. |
rm file.txt deletes the file named "file.txt". rm -r my_directory deletes the directory "my_directory" and its contents. rm -f file.txt forcefully deletes the file "file.txt" without confirmation. |
cp | Copy files and directories. | -r: Copy directories recursively. | cp -r directory destination copies the directory "directory" and its contents to the specified destination. cp file.txt destination copies the file "file.txt" to the specified destination. |
mv | Move/rename files and directories. | N/A | mv file.txt new_name.txt renames the file "file.txt" to "new_name.txt". mv file.txt directory moves the file "file.txt" to the specified directory. |
find | Search for files and directories. | -name: Search by filename. | find /path/to/search -name “*.txt” searches for all files with the extension “.txt” in the specified directory. |