Linux CheatSheet :)

ยท

2 min read

Linux CheatSheet :)

Essential Commands

  • ls: List the contents of the current directory

  • cd: Change directory

  • pwd: Print the working directory

  • mkdir: Create a new directory

  • rmdir: Remove a directory

  • cp: Copy a file

  • mv: Move a file

  • rm: Remove a file

  • nano: Open a text editor

  • cat: Concatenate files

  • grep: Search for patterns in files

  • sudo: Run a command as another user

File and Directory Permissions

  • chmod: Change the permissions of a file or directory

  • chown: Change the owner of a file or directory

  • chgrp: Change the group of a file or directory

Processes

  • ps: List all running processes

  • top: Display a real-time list of running processes

  • kill: Terminate a running process

Networking

  • ping: Send a ping request to a host

  • ifconfig: Display information about network interfaces

  • traceroute: Trace the route to a host

Other Useful Commands

  • man: Display the manual page for a command

  • history: Display a list of recently executed commands

  • clear: Clear the terminal screen

System Administration

  • apt-get: Install, remove, and update software packages

  • yum: Install, remove, and update software packages (Red Hat and CentOS)

  • dnf: Install, remove, and update software packages (Fedora)

  • systemctl: Control system services

Troubleshooting

  • dmesg: Display kernel messages

  • strace: Trace the system calls made by a process

  • ltrace: Trace the library calls made by a process

Tips and Tricks

  • Use the Ctrl + R shortcut to search through your command history.

  • You can use the sudo command to run commands as another user. This is useful for performing administrative tasks.

  • Use the man command to read the manual page for a command. This is a great way to learn more about how to use a command and its options.

  • You can use the | (pipe) character to chain commands together. This allows you to output the results of one command to the input of another command.

  • You can use the > (redirect) character to redirect the output of a command to a file.

ย