> For the complete documentation index, see [llms.txt](https://codexpress.gitbook.io/operating-system-showdown/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codexpress.gitbook.io/operating-system-showdown/components-of-os/system-calls/common-linux-commands.md).

# Common Linux Commands

## Common Linux Commands

Here is a list of 50 commonly used Linux commands along with brief descriptions and example usages:

1. **pwd (Print Working Directory):**
   * Displays the current working directory.
   * Example: `pwd`
2. **ls (List Directory Contents):**
   * Lists files and directories in the current directory.
   * Example: `ls`
3. **cd (Change Directory):**
   * Changes the current directory.
   * Example: `cd /path/to/directory`
4. **touch (Create Empty File):**
   * Creates an empty file.
   * Example: `touch filename.txt`
5. **mkdir (Make Directory):**
   * Creates a new directory.
   * Example: `mkdir new_directory`
6. **rm (Remove):**
   * Removes files and directories.
   * Example: `rm filename.txt` or `rm -r directory`
7. **cp (Copy):**
   * Copies files and directories.
   * Example: `cp file.txt newfile.txt` or `cp -r dir1 dir2`
8. **mv (Move/Rename):**
   * Moves or renames files and directories.
   * Example: `mv file.txt new_directory/` or `mv oldname.txt newname.txt`
9. **cat (Concatenate and Display):**
   * Displays the content of a file.
   * Example: `cat file.txt`
10. **more/less (View Text File):**
    * Displays the content of a text file page by page.
    * Example: `more file.txt` or `less file.txt`
11. **head (Display Beginning of a File):**
    * Shows the first few lines of a file.
    * Example: `head -n 10 file.txt` (displays the first 10 lines)
12. **tail (Display End of a File):**
    * Shows the last few lines of a file.
    * Example: `tail -n 10 file.txt` (displays the last 10 lines)
13. **grep (Global Regular Expression Print):**
    * Searches for text patterns in files.
    * Example: `grep "pattern" file.txt`
14. **find (Find Files and Directories):**
    * Searches for files and directories in a directory hierarchy.
    * Example: `find /path/to/search -name "*.txt"`
15. **chmod (Change File Permissions):**
    * Modifies file permissions.
    * Example: `chmod 644 file.txt` (sets read and write for owner, read for group and others)
16. **chown (Change File Owner):**
    * Changes the owner of a file.
    * Example: `chown user:group file.txt`
17. **ps (Process Status):**
    * Displays information about running processes.
    * Example: `ps aux`
18. **top (Monitor System Activity):**
    * Provides real-time system resource usage statistics.
    * Example: `top`
19. **kill (Terminate a Process):**
    * Terminates a running process by process ID.
    * Example: `kill PID`
20. **tar (Tape Archive):**
    * Archives and extracts files.
    * Example: `tar -cvf archive.tar files/` (create archive), `tar -xvf archive.tar` (extract archive)
21. **df (Disk Free):**
    * Displays disk space usage.
    * Example: `df -h`
22. **du (Disk Usage):**
    * Shows disk usage of files and directories.
    * Example: `du -sh /path/to/directory`
23. **free (Memory Usage):**
    * Displays system memory usage.
    * Example: `free -h`
24. **ifconfig (Network Configuration):**
    * Displays and configures network interfaces.
    * Example: `ifconfig`
25. **ping (Network Ping):**
    * Tests network connectivity to a host.
    * Example: `ping google.com`
26. **ssh (Secure Shell):**
    * Connects to remote servers securely.
    * Example: `ssh user@hostname`
27. **scp (Secure Copy):**
    * Copies files securely between hosts.
    * Example: `scp file.txt user@hostname:/path/`
28. **wget (Web Get):**
    * Downloads files from the internet.
    * Example: `wget URL`
29. **curl (Client for URLs):**
    * Transfers data from or to a server.
    * Example: `curl URL`
30. **nano (Text Editor):**
    * Opens a terminal-based text editor.
    * Example: `nano filename.txt`
31. **vim (Text Editor):**
    * Opens the Vim text editor.
    * Example: `vim filename.txt`
32. **grep (Global Regular Expression Print):**
    * Searches for text patterns in files.
    * Example: `grep "pattern" file.txt`
33. **sort (Sort Lines of Text):**
    * Sorts lines of text files.
    * Example: `sort file.txt`
34. **uniq (Unique Lines):**
    * Filters out duplicate lines in a sorted file.
    * Example: `sort file.txt | uniq`
35. **sed (Stream Editor):**
    * Performs text transformations on an input stream.
    * Example: `sed 's/old/new/' file.txt`
36. **awk (Text Processing Tool):**
    * Processes text data and generates reports.
    * Example: `awk '{print $1}' file.txt`
37. **date (Display or Set Date and Time):**
    * Displays or sets the system date and time.
    * Example: `date`
38. **cal (Display Calendar):**
    * Displays a calendar.
    * Example: `cal`
39. **shutdown (Shutdown/Reboot System):**
    * Shuts down or reboots the system.
    * Example: `shutdown -h now` (shut down immediately)
40. **useradd (Add User):**
    * Adds a new user to the system.
    * Example: `sudo useradd newuser`
41. **passwd (Change Password):**
    * Changes a user's password.
    * Example: `passwd username`
42. **groups (List Groups):**
    * Lists groups a user belongs to.
    * Example: `groups username`
43. **who (Show Who is Logged On):**
    * Displays information about users currently logged in.
    * Example: `who`
44. **uptime (System Uptime):**
    * Shows how long the system has been running.
    * Example: `uptime`
45. **hostname (Display or Set Hostname):**
    * Displays or sets the system's hostname.
    * Example: `hostname`
46. **history (Command History):**
    * Shows the command history for the current user.
    * Example: `history`
47. **chmod (Change File Permissions):**
    * Modifies file permissions.
    * Example: `chmod 644 file.txt`
48. **chown (Change File Owner):**
    * Changes the owner of a file.
    * Example: `chown user:group file.txt`
49. **alias (Create Command Aliases):**
    * Creates shortcuts for frequently used commands.
    * Example: \`alias ll ='ls -l'\` (creates an alias "ll" for "ls -l")
50. **history (Command History):**
    * Displays the command history for the current user.
    * Example: `history`

Please note that these are just basic examples, and many of these commands have additional options and capabilities that can be explored by using the `man` command to access the manual pages (e.g., `man ls`, `man grep`). Additionally, some commands may require superuser privileges and should be used with caution.
