25+ Linux Commands Every Developer Should 
Know-1:

25+ Linux Commands Every Developer Should Know-1:

CLI to make you a better developer.

Table of contents

No heading

No headings in the article.

Every developer should be familiar with the Linux Operating system. While the GUI of the massive operating system has improved with time, seasoned and aspirational developers still massively believe in the use of CLI. In this article, you will get yourself acquainted with the basic Linux terminal commands every developer should know in to make himself more productive while staring at the black screen and typing the blinking cursor with preferably colored letters preceding the cursor.

1. ls - This command lists the files and directories in a directory.

Usage: ls [options][directory]

Terminology:

  • options: optional parameters that modify the behavior of the command

  • directory: the location of the files and directories you want to list

Application: This command is commonly used to view the contents of a directory.

Console output:

2. cd - This command changes the current working directory.

Usage: cd [directory]

Terminology:

  • directory: the location you want to change to

Application: This command is used to navigate the file system.

console output:

3. pwd - This command prints the current working directory.

Usage: pwd

Terminology:

Gives you the present working directory.

Application: This command is used to determine the current location in the file system.

console output:

4. mkdir - This command creates a new directory.

Usage: mkdir [options] directory

Terminology:

  • options: optional parameters that modify the behavior of the command

  • directory: the name of the new directory

Application: This command is used to create new directories in the file system.

console output:

5. rm - This command removes a file or directory.

Usage: rm [options] file

Terminology:

  • options: optional parameters that modify the behavior of the command

  • file: the name of the file or directory you want to remove

Application: This command is used to delete files and directories from the file system.

console output:

6. mv - This command moves a file or directory to a new location.

Usage: mv [options] source destination

Terminology:

  • options: optional parameters that modify the behavior of the command

  • source: the file or directory you want to move

  • destination: the location you want to move the file or directory to

Application: This command is used to relocate files and directories within the file system. It can also be used to rename the files.

console output:

7. cp - This command copies a file or directory to a new location.

Usage: cp [options] source destination

Terminology:

  • options: optional parameters that modify the behavior of the command

  • source: the file or directory you want to copy

  • destination: the location you want to copy the file or directory to

Application: This command is used to create copies of files and directories within the file system.

console output:

8. grep - This command searches for a pattern in a file or group of files.

Usage: grep [options] pattern [files]

Terminology:

  • options: optional parameters that modify the behavior of the command

  • pattern: the text you want to search for

  • files: the files you want to search in

Application: This command is used to find specific text within a file or group of files.

console output:

9. sort - This command sorts the lines of a file.

Usage: sort [options] [file]

Terminology:

  • options: optional parameters that modify the behavior of the command

  • file: the file you want to sort

Application: This command is used to organize the lines of a file in a specific order.

console output:

10. uniq - This command removes duplicate lines from a file occurring concurrently.

Usage: uniq [options] [file]

Terminology:

  • options: optional parameters that modify the behavior of the command

  • file: the file you want to remove duplicate lines from

Application: This command is used to remove duplicate lines from a file, leaving only unique lines.

console output:

11. whoami - This command allows you to see the status of the currently logged-in user.

Usage: whoami [option]...

Terminology:

  • options: optional parameters that modify the behavior of the command

Application: This command is often used to know the privileges of the user.

Console output:

If you noticed the sudo -s command, well done- we will discuss the sudo -s command below and learn what sudo means

12. - sudo -s: This command gives you the root user privileges.

Usage: sudo -s

Alternatives:sudo -i

Terminology:

  • options: optional parameters that modify the behavior of the command. Some common options include:

    • -u: specify the user to run the command as

    • -s: run the command in a login shell

    • -i: run the command with an environment similar to a login shell

  • command: the command you want to execute as a different user

  • directory: the location you want to change to

Application: This command is used to execute the commands with elevated privileges.

console output:

13. head - This command prints the top few lines of a file.

Usage: head [options] [file]

Terminology:

  • options: optional parameters that modify the behavior of the command. Some common options include:

    • -n: specify the number of lines to display

    • -c: specify the number of bytes (characters) to display

  • file: the file you want to display the first few lines of

Application: This command is used to view the beginning of a file, which can be useful for quickly checking the contents of a large file.

console output:

14. tail - This command displays last few lines of a file.

Usage:tail [options] [file]

Terminology:

  • options: optional parameters that modify the behavior of the command

  • file: the file you want to display the last few lines of

Application: This command is used to view the end of a file, which can be useful for tracking changes to a file over time.

console output:

15. rm - This command removes a file or directory.

Usage: rm [options] file

Terminology:

  • options: optional parameters that modify the behavior of the command

  • file: the name of the file or directory you want to remove

Application: This command is used to delete files and directories from the file system.

console output:

16. wc - This command counts the number of characters in a file.

Usage: wc [options] [file]

Terminology:

  • options: optional parameters that modify the behavior of the command

  • file: the file you want to count the lines, words, and characters of

Application: This command is used to get a summary of the contents of a file.

console output:

17. chmod - This command changes the permission of a file or a directory.

Usage: chmod [options] mode file

Terminology:

  • options: optional parameters that modify the behavior of the command

  • mode: the permissions you want to set for the file or directory

  • file: the file or directory you want to change the permissions of

Application: This command is used to control access to files and directories.

console output:

If you are curios about the stat command in the console window shown above, you can learn about it after this sentence ends:).

18.stat - The stat command is used to display information about a file or directory. Here is the usage again with more detail:

Usage: stat [options] file

Terminology:

  • options: optional parameters that modify the behavior of the command. Some common options include:

    • --format: specify the output format

    • --printf: specify a custom output format using printf-style format specifiers

  • file: the file or directory you want to display information about

Application: This command is used to get detailed information about a file or directory, including its size, permissions, timestamps, and more.

console output:

19.find - This command searches for files and directories based on various criteria.

Usage: find [directory] [options] [expression]

Terminology:

  • directory: the location you want to search for files and directories in

  • options: optional parameters that modify the behavior of the command

  • expression: the criteria you want to use to search for files and directories

Application: This command is used to locate files and directories within the file system.

console output:

20 echo-This command displays a message on the console.

Usage: echo [options] [string].

Terminology:

  • options: optional parameters that modify the behavior of the command

  • string: the message you want to display

Application: This command is used to output a message on the console.

21 man - This command displays the manual pages for a command.

Usage: man [command]

Terminology:

  • command: the command you want to display the manual pages for

Application: This command is used to get detailed information about a command, including its usage, options, and examples.

console output:

22 help-The help command is a built-in command in the Bash shell that is used to display information about other commands.

Usage: help [command]

Terminology:

  • command: the command you want to display information about

Application: This command is used to get help with using other commands.

console output:

23 cat-The cat command is used to concatenate and display the contents of one or more files. Here is the usage again with more detail:

Usage: cat [options] [file]

Terminology:

  • options: optional parameters that modify the behavior of the command. Some common options include:

    • -n: number all output lines

    • -b: number nonempty output lines, avoiding blank lines

    • -s: suppress repeated adjacent blank lines

    • -T: display TAB characters as ^I

  • file: the file(s) you want to concatenate and display

Application: This command is used to view the contents of a file or to combine multiple files into a single output.

console output:

24-df-The df command is used to display information about the available and used disk space on a file system. Here is the usage again with more detail:

Usage: df [options] [file]

Terminology:

  • options: optional parameters that modify the behavior of the command. Some common options include:

    • -h: display sizes in human-readable format (e.g. 1K, 234M, 2G)

    • -T: display the file system type

    • -x: exclude a particular file system type from the output

  • file: the file or file system you want to display information about

Application: This command is used to get information about the disk space usage on a file system.

console output:

25 du[disk usage characteristics] - The du command is used to display the sizes of directories and their contents. Here is the usage again with more detail:

Usage: du [options] [file]

Terminology:

  • options: optional parameters that modify the behavior of the command. Some common options include:

    • -a: display sizes for all files, not just directories

    • -h: display sizes in human-readable format (e.g. 1K, 234M, 2G)

    • -c: display a grand total

  • file: the file or directory you want to display the size of

Application: This command is used to display the sizes of directories and their contents.

console output:

26- chown-The chown command is used to change the owner and/or group of a file or directory. Here is the usage again with more detail:

Usage: chown [options] owner[:group] file

Terminology:

  • options: optional parameters that modify the behavior of the command. Some common options include:

    • -R: operate recursively on directories

    • -v: verbose mode, display the change made for each file

  • owner: the new owner for the file

  • group: the new group for the file

  • file: the file or directory whose owner and/or group you want to change

Application: This command is used to change the owner and/or group of a file or directory.

console output:

27- open - This command is used to open a file or a directory.

The open command is a utility on macOS and Linux systems that is used to open a file, folder, or URL with the default application associated with that type of file or resource. Here is the usage again with more detail:

Usage: open [options] file

Terminology:

  • options: optional parameters that modify the behavior of the command. Some common options include:

    • -a: specify the application to open the file or resource with

    • -e: open the file with a text editor

    • -t: open the file with the default text editor

  • file: the file, folder, or URL you want to open

Application: This command is used to open a file, folder, or URL with the default application associated with that type of file or resource.

console output: