Common Linux Commands
cd
cd Moves the user into the specified directory. Change Directory.
cd .. to move one directory up
cd by itself to move to home directory
cd - to move to previous directory
cd <directory-path> to move to a directory (can be an absolute path or relative path)
cp <old_filepath> <new directory path>
cp <old_filepath> <new directory path> Copies the file into the specified directory
clear
clearClears the terminal
cat <filename>
cat <filename>Lists the contents of a file. Concatenate files.
ls
lsList contents within the current directory
grep <string_to_match> <filename>
grep <string_to_match> <filename>Searches for the string / regular expression within the specified file and prints the line(s) with the result
pwd
pwdDisplays the path of the current directory that you are in. Present Working Directory
man <command>
man <command>Displays the help manual instruction for the given command
mv <file_name> <new_directory>
mv <file_name> <new_directory>Moves a file into a new directory.
mv <old_file_name> <new_file_name> to rename a file
mkdir <directory_name>
mkdir <directory_name>Creates a new directory
rm <file_name>
rm <file_name>Deletes a file
rm -r <directory_name>
rm -r <directory_name>Deletes directories and the contents within them. -r stands for recursive
rmdir <directory_name>
rmdir <directory_name>Removes the specified directory (must be empty)
touch
touchCreates a blank new file
Last updated
Was this helpful?