Linux Command Cheat Sheet: Most Used Linux Commands Linux File Commands
Linux Command Cheat Sheet: Most Used Linux Commands Linux File Commands
pwd Displays the current working directory rm -r [directory_name] Remove a directory and files
path, starting from the root (/) recursively
cp -r [directory_name1] Used to copy a directory including
rm [file_name] To remove files you no longer need [directory_name2] all its content from a source
directory to the destination
directory.
Shows a file's contents one screen
less [filename] at a time Move file_name1 to file_name2
mv [file_name1] [file_name2]
Is used to change the current working
cd [directory] directory in Linux tail [file_name] Prints the last 10 lines from the file
ssh user@server -p other_port Operate a specific port declared touch [file_name] Used to create, change and
in sshd_config modify timestamps of a file
ssh [IP address] Connect to a host wc Used to find out number of lines,
word count, byte and characters
count in the files
ssh-copy-id hostname_or_IP Copy a unique key pair to server
gpg -c [file_name] Decrypts the files securely
ssh user@server Connect to a server (default port)
head [file_name] Allows you to easily get the top
lines from the specified file or the
ssh user@server [command to run] Run a command on a remote server standard input
cat /proc/cpuinfo Display detailed information about (sudo) service ssh stop Stop ssh service
the CPU
lsusb (or -v for verbose) Show information about all usb finger [username] Display information about a
devices. user
Display sorted information about groups [username] Display the groups a user
top belongs to
processes
sudo systemctl restart Restart a service chown user:group /path/to/file Change ownership of a file
[service_name] Eg. sudo systemctl restart apache2
OTHER
export [variable_name]
Create a new environment variable
=[variable_value]