Linux Essential Commands Cheatsheet

By IncludeHelp Last updated : October 19, 2024

Basic Commands

1. Operators

&& (and), || (or)

command1 && command2
command1 || command2

2. apropos

Returns all documentation containing the defined command.

apropos user

3. bzip/bunzip

Compresses files.

bzip2 file.txt
bunzip2 file.txt.bz2

4. cat

Outputs the contents of a file.

cat file.txt

5. cd

Change directory.

cd /home/user/Documents

6. chmod

Change file mode.

chmod 755 file.sh

7. chown

Change ownership.

chown user:group file.txt

8. clear

Clears the screen.

clear

File System Navigation Commands

1. pwd

Prints the current working directory.

pwd

2. cd

Changes directory.

cd /home/user/Documents

Moves you to the "Documents" directory.

3. ls

Lists files and directories.

ls -la

Lists all files, including hidden ones, with detailed information.

4. mkdir

Creates a new directory.

mkdir new_folder

Creates a new directory named "new_folder".

5. rmdir

Removes a directory.

rmdir old_folder

Removes the empty directory "old_folder"

6. cp

Copies files and directories.

cp file.txt /home/user/Documents/

Copies "file.txt" to the "Documents" directory.

7. mv

Moves or renames files and directories.

mv file.txt /home/user/Desktop/

Moves "file.txt" to the "Desktop" directory.

8. rm

Removes/deletes files.

rm unwanted_file.txt

Deletes the file "unwanted_file.txt".

9. touch

Creates an empty file.

touch newfile.txt

Creates an empty file named "newfile.txt".

System and Network Utilities Commands

1. find

Locate a file in the system.

find / -name "file.txt"

2. finger

Find out information regarding a user.

finger user

3. free

Reports on system memory.

free -h

4. grep

Search for a string in files.

grep "error" log.txt

File Management and Archives Commands

1. rm

Remove files.

rm file.txt

2. shutdown

Shuts down the system.

shutdown -h now

3. tar

Archive files.

tar -cf archive.tar file1 file2

System Monitoring Commands

1. uname

Display system information.

uname -a

2. w

Displays user system information.

w

Other Useful Commands

1. whoami

Outputs the current username.

whoami

2. zip/unzip

Compress or extract files.

zip archive.zip file1

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.