Beginner Linux Command Cheat Sheet

Beginner Linux Command Cheat Sheet Free: Essential Commands for New Users

Linux is a powerful and flexible operating system that is widely used in various environments, from personal computers to servers. For beginners, navigating through Linux can be daunting due to its command-line interface. However, with the right set of commands, you can quickly become proficient in managing your Linux system. This beginner Linux command cheat sheet covers essential commands that will help you get started and become more comfortable using Linux.

Getting Started Beginner Linux Command Cheat Sheet Free

Before diving into the commands, it’s important to understand the terminal, the command-line interface used to interact with the Linux operating system. You can open the terminal in most Linux distributions by pressing Ctrl + Alt + T.

Basic Commands

1. pwd (Print Working Directory)

Displays the current directory you are in.

sh  Copy code
pwd

2. ls (List)

Lists files and directories in the current directory.

sh  Copy code
ls

Options:

  • ls -l: Lists files in long format.
  • ls -a: Lists all files, including hidden ones.

3. cd (Change Directory)

Changes the current directory.

sh  Copy code
cd /path/to/directory
  • cd ~: Changes to the home directory.
  • cd ..: Moves up one directory level.

4. mkdir (Make Directory)

Creates a new directory.

sh  Copy code
mkdir new_directory

5. rmdir (Remove Directory)

Deletes an empty directory.

sh  Copy code
rmdir directory_name

6. rm (Remove)

Deletes files or directories.

sh  Copy code
rm file_name

Options:

  • rm -r directory_name: Deletes a directory and its contents recursively.

7. touch

Creates an empty file or updates the timestamp of an existing file.

sh  Copy code
touch new_file

8. cp (Copy)

Copies files or directories.

sh  Copy code
cp source_file destination_file

Options:

  • cp -r source_directory destination_directory: Copies directories recursively.

9. mv (Move)

Moves or renames files or directories.

sh  Copy code
mv old_name new_name

10. cat (Concatenate)

Displays the contents of a file.

sh  Copy code
cat file_name

11. nano

Opens the Nano text editor to edit files.

sh  Copy code
nano file_name

System Information

12. uname

Displays system information.

sh  Copy code
uname -a

13. top

Shows real-time system processes and resource usage.

sh  Copy code
top

14. df (Disk Free)

Displays disk space usage.

sh  Copy code
df -h

15. du (Disk Usage)

Shows the size of a directory and its contents.

sh  Copy code
du -sh directory_name

16. free

Displays memory usage.

sh  Copy code
free -h

File Permissions

17. chmod (Change Mode)

Changes file permissions.

sh  Copy code
chmod 755 file_name

18. chown (Change Owner)

Changes file owner and group.

sh  Copy code
chown user:group file_name

Searching and Finding Files

19. find

Searches for files in a directory hierarchy.

sh  Copy code
find /path/to/search -name file_name

20. grep (Global Regular Expression Print)

Searches for a pattern within files.

sh  Copy code
grep "pattern" file_name

Options:

  • grep -r "pattern" /path/to/search: Recursively searches within a directory.

Network Commands

21. ping

Checks connectivity to a host.

sh  Copy code
ping host_name_or_ip

22. ifconfig

Displays network configuration.

sh  Copy code
ifconfig

23. wget

Downloads files from the internet.

sh  Copy code
wget http://example.com/file

24. ssh (Secure Shell)

Connects to a remote server securely.

sh  Copy code
ssh user@host

Process Management

25. ps (Process Status)

Displays currently running processes.

sh  Copy code
ps aux

26. kill

Terminates a process by PID (Process ID).

sh  Copy code
kill PID

Options:

  • kill -9 PID: Forcefully terminates a process.

Package Management

27. apt-get

Manages packages on Debian-based systems (like Ubuntu).

sh  Copy code
sudo apt-get update
sudo apt-get install package_name

28. yum

Manages packages on Red Hat-based systems (like CentOS).

sh  Copy code
sudo yum update
sudo yum install package_name

29. dpkg

Manages Debian packages.

sh  Copy code
sudo dpkg -i package_name.deb

30. rpm

Manages Red Hat packages.

sh  Copy code
sudo rpm -i package_name.rpm

Text Processing

31. head

Displays the first few lines of a file.

sh  Copy code
head file_name

32. tail

Displays the last few lines of a file.

sh  Copy code
tail file_name

Options:

  • tail -f file_name: Follows the file, displaying new lines as they are added.

33. wc (Word Count)

Counts lines, words, and characters in a file.

sh  Copy code
wc file_name

34. sort

Sorts lines of text files.

sh  Copy code
sort file_name

35. uniq

Removes duplicate lines from a sorted file.

sh  Copy code
uniq file_name

Archiving and Compression

36. tar

Archives files into a tarball.

sh  Copy code
tar -cvf archive_name.tar file_or_directory

Options:

  • tar -xvf archive_name.tar: Extracts a tarball.

37. gzip

Compresses files.

sh  Copy code
gzip file_name

38. gunzip

Decompresses files.

sh  Copy code
gunzip file_name.gz

User Management

39. adduser

Adds a new user.

sh  Copy code
sudo adduser user_name

40. passwd

Changes a user’s password.

sh  Copy code
passwd user_name

41. usermod

Modifies a user account.

sh  Copy code
sudo usermod -aG group_name user_name

42. deluser

Deletes a user.

sh  Copy code
sudo deluser user_name

43. whoami

Displays the current logged-in user.

sh  Copy code
whoami

Disk Management

44. mount

Mounts a file system.

sh  Copy code
sudo mount /dev/sdX /mnt

45. umount

Unmounts a file system.

sh  Copy code
sudo umount /mnt

46. fsck (File System Check)

Checks and repairs a file system.

sh  Copy code
sudo fsck /dev/sdX

System Monitoring

47. uptime

Displays how long the system has been running.

sh  Copy code
uptime

48. dmesg (Display Message)

Displays system messages.

sh  Copy
dmesg

49. journalctl

Views systemd logs.

sh  Copy code
sudo journalctl

50. htop

Interactive process viewer.

sh  Copy code
htop

Conclusion

This beginner Linux command cheat sheet provides a foundation to help you navigate and manage your Linux system. As you become more comfortable with these commands, you’ll be able to perform a wide range of tasks more efficiently. Remember, practice is key to mastering Linux, so don’t hesitate to experiment with these commands and explore further. Happy learning!

Scroll to Top