DEV Community

Cover image for 20 Essential Linux Commands Every Developer Should Know
Olateju Olamide Emmanuel
Olateju Olamide Emmanuel

Posted on

20 Essential Linux Commands Every Developer Should Know

The Linux command line is a powerful tool for developers. Mastering these essential commands will boost your productivity, simplify complex tasks, and give you greater control over your development environment. Whether you're on Ubuntu, Mint, or any other Linux distribution, these commands are your gateway to efficient development.

Navigation & File Management:

  1. cd (Change Directory): Navigate through the file system. cd /path/to/directory cd .. (go up one level).
  2. pwd (Print Working Directory): Shows your current directory's path.
  3. ls (List Files): Lists files and directories. ls -l (long listing with details), ls -a (show hidden files).
  4. mkdir (Make Directory): Creates a new directory. mkdir new_directory
  5. rmdir (Remove Directory): Removes an empty directory. rmdir empty_directory)
  6. rm (Remove File/Directory): Removes files or directories. rm file.txt, rm -r directory (recursive remove).
  7. cp (Copy): Copies files or directories. cp file.txt new_file.txt, cp -r directory new_directory
  8. mv (Move/Rename): Moves or renames files or directories. mv file.txt new_location/, mv old_name.txt new_name.txt
  9. touch: Creates an empty file. touch new_file.txt

Working with Text

  1. cat (Concatenate): Displays file content. cat file.txt
  2. head: Displays the first few lines of a file. head -n 10 file.txt (first 10 lines).
  3. tail: Displays the last few lines of a file. tail -f file.txt (follow file changes).
  4. grep (Global Regular Expression Print): Searches for patterns in text. grep "pattern" file.txt
  5. sed (Stream Editor): Manipulates text in files. Powerful for find and replace. sed 's/old/new/g' file.txt
  6. awk: A powerful text processing tool. Useful for data extraction and formatting.

System & Processes:

  1. ps (Process Status): Lists running processes. ps aux (detailed listing).
  2. top or htop: Interactive process monitor. Shows real-time system resource usage. (Install htop if not present: sudo apt install htop or sudo pacman -S htop)
  3. kill: Terminates a process. kill PID (process ID). 19 sudo (Super User Do): Executes a command as the root user (administrator). sudo apt update
  4. man (Manual): Displays the manual page for a command. man ls

Bonus Tip:

  • history: Shows your command history. Use !number to repeat a previous command.

  • whatis: shows a command / displays one line manual page descriptions of Linux terminal commands
    Learning these 20 commands will significantly improve your command-line skills and make you a more efficient developer on Linux. Practice them regularly, and you'll find yourself using them constantly!

Top comments (0)