Cheat Sheet about Linux commands

LINUX COMMANDS CHEAT SHEET

pwd – Shows the current directory.

ls – Lists files and directories.

ls -l – Lists with details (permissions, owner, size, date).

cd [directory] – Changes directory.

cd .. – Moves up one level in the directory structure.

cd / – Goes to the root directory.

touch [file] – Creates an empty file.

cp [source] [destination] – Copies a file or directory.

mv [source] [destination] – Moves or renames a file or directory.

rm [file] – Deletes a file.

rm -r [directory] – Deletes a directory and its contents.

cat [file] – Displays the content of a file.

less [file] – Allows paginated viewing of a file.

head [file] – Shows the first 10 lines of a file.

tail [file] – Shows the last 10 lines of a file.

grep “text” [file] – Searches for text within a file.

chmod [permissions] [file] – Changes file permissions.

chown [user:group] [file] – Changes file ownership.

tar -cvf file.tar [files] – Creates a tar file.

tar -xvf file.tar – Extracts a tar file.

gzip [file] – Compresses a file.

gunzip [file.gz] – Decompresses a .gz file.

zip [file.zip] [files] – Creates a ZIP file.

unzip [file.zip] – Extracts a ZIP file.

whoami – Shows the current user.

who – Displays users connected to the system.

adduser [user] – Adds a new user.

deluser [user] – Deletes a user.

passwd [user] – Changes a user’s password.