Linux commands cheat sheet
Linux commands cheat sheet
Mohamed Atef
Elbitawy
Mohamed Atef
Elbitawy
type cd Find out whether cd binary is built-in, alias, or external binary file
Stardz.dz@gmail.com 20 Dec 2024
Mohamed Atef
Elbitawy
Displays the content of the file in reverse order (from the last line
tac file.txt to the first).
more file.txt Allows you to view large text files one screen at a time.
Compares two files line by line and shows the differences between
diff file1.txt file2.txt them.
Mohamed Atef
Elbitawy
find /data -name hello.txt Searches for the file hello.txt inside the /data directory.
Directory Traversal
cd ../.. used to change directories and move up two levels in the file
Stardz.dz@gmail.com 20 Dec 2024
Mohamed Atef
Elbitawy
du -h /home Shows the size of files and directories within the /home directory.
mount /dev/sda1 /mnt Mounts the partition /dev/sda1 to the /mnt directory.
Mohamed Atef
Elbitawy
used to display the status of jobs that are running or have been
jobs started in the background within the current shell session
The nice command is used to start a process with a user defined
nice vim text & priority
Stardz.dz@gmail.com 20 Dec 2024
Mohamed Atef
Elbitawy
Mohamed Atef
Elbitawy
chmod u-w file1 Removes write permission for the user (owner) on file1.
chmod u+w,g+wx,o+r Adds write permission for the user, write and execute permissions
file1 for the group, and read permission for others on file1.
Sets read and write permissions for all users (owner, group, and
chmod a=rw file1 others) on file1.
Adds read and write permissions for all users (owner, group, and
chmod +rw file1 others) on file1.
chown -R Ali dir1 Recursively changes the owner of dir1 and its contents to Ali
chown user:group
Changes the ownership of file.txt to user and group group.
file.txt
Changes the group ownership of file1 to sales without altering the
chown :sales file1 file’s owner.
Sets the defaults perms for newly created files to 644 and for
umask 022 directories to 755
Stardz.dz@gmail.com 20 Dec 2024
Mohamed Atef
Elbitawy
gzip data Compresses the file data using Gzip, creating data.gz.
Mohamed Atef
Elbitawy
Mohamed Atef
Elbitawy
Mohamed Atef
Elbitawy
Mohamed Atef
Elbitawy
passwd mohamed Sets or changes the password for the user mohamed.