Basic Linux Commands

Ayesha SaherAyesha Saher
2 min read

I learned these Linux commands.

Linux Commands Cheat sheet

Here's a most commonly used Linux commands:

Navigation

  • pwd: Print the current working directory

  • ls: List files and directories in the current directory

  • cd <directory>: Change the current working directory to the specified directory

File Management

  • touch <file>: Create a new, empty file

  • cat <file>: Display the contents of a file

  • cp <source> <destination>: Copy a file or directory

  • mv <source> <destination>: Move or rename a file or directory

  • rm <file>: Remove (delete) a file

  • rm -r <directory>: Remove a directory and its contents recursively

Directory Management

  • mkdir <directory>: Create a new directory

  • mkdir -p <directory/subdirectory>: Create a directory hierarchy

Process Management

  • ps: List running processes

  • top: Display real-time information about running processes

  • kill <PID>: Terminate a process by its process ID (PID)

System Information

  • uname -a: Display information about the operating system

  • df -h: Display available disk space

  • free -h: Display available memory

Command History

  • history: Display the command history

  • !!: Repeat the last command

  • !<command>: Repeat the most recent command starting with the specified text

Helpful Tips

  • Use the Tab key for auto-completion of file and directory names

  • Ctrl+C to terminate the current process

  • Ctrl+L to clear the terminal screen

This is just an overview of the basic Linux commands. There are many more commands available. So keep exploring and learning!

1
Subscribe to my newsletter

Read articles from Ayesha Saher directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ayesha Saher
Ayesha Saher