just tiff me logo

43 Linux Command Line Hacks every developer should know!

43 Linux command lines for every developers

Table of Contents

The command line is an indispensable tool for developers working on Linux-based systems. It provides a powerful and efficient way to interact with the operating system, perform various tasks, and manage the development environment.
If you are a developer, mastering the command line can significantly boost your productivity and make your life much easier.
In this article, we will explore some of the most fundamental and useful Linux commands that you cannot afford to ignore as a developer. From basic navigation to advanced system operations, these commands will equip you with the necessary skills to work proficiently in a Linux environment.
CategoryCommandDescriptionUsage Example
Basic NavigationlsList files and directoriesls
cdChange directoriescd /path/to/directory
pwdPresent working directorypwd
mkdirCreate directoriesmkdir new_directory
rmdirRemove empty directoriesrmdir empty_directory
File OperationstouchCreate filestouch new_file.txt
cpCopy files and directoriescp file.txt /path/to/destination/
mvMove or rename files and directoriesmv file.txt /path/to/destination/
rmRemove files and directoriesrm file.txt
catDisplay file contentcat file.txt
more / lessView file content page by pageless large_file.txt
Text ProcessinggrepSearch for patterns in filesgrep 'keyword' file.txt
sedStream editor for text manipulationecho 'Hello World!'| sed 's/Hello/Hi/'
awkText processing and data extractionawk '{print $1}' data.txt
System InformationtopMonitor system processestop
freeCheck memory usagefree -h
df / duDisplay disk space informationdf -h | du -h
unameShow system informationuname -a
psDisplay process statusps aux
Package Managementapt / apt-getDebian-based package managementsudo apt update | sudo apt install package_name
yumRed Hat-based package managementsudo yum update | sudo yum install package_name
dnfNext-generation package managersudo dnf update | sudo dnf install package_name
pacmanArch Linux package managementsudo pacman -Syu | sudo pacman -S package_name
NetworkingpingCheck network connectivityping google.com
ifconfig / ipConfigure network interfacesifconfig
sshSecurely access remote machinesssh user@remote_host
scpCopy files between local and remote systemsscp file.txt user@remote_host:/path/to/destination/
curl / wgetDownload files from the webcurl -O https://example.com/file.txt
File PermissionschmodChange file permissionschmod +x script.sh
chownChange file ownershipchown user file.txt
chgrpChange group ownershipchgrp group file.txt
Compression and ArchivingtarCreate and extract tarballstar -cvf archive.tar file1 file2
gzip / gunzipCompress and decompress filesgzip file.txt | gunzip file.txt.gz
Process Managementkill / killallTerminate processeskill process_id | killall process_name
bg / fgManage background and foreground processesbg | fg
Environment VariablesexportSet environment variablesexport VARIABLE_NAME=value
echoDisplay the value of variablesecho $VARIABLE_NAME
Command HistoryhistoryView command historyhistory
Ctrl+RSearch command history(Press Ctrl+R and type search query)
Useful UtilitiesdateDisplay or set the system date and timedate
calDisplay a calendarcal
bcCommand-line calculatorecho '2+2' | bc

Basic Navigation Commands

1. ls : Listing Files and Directories
The ls command is used to list the files and directories in the current working directory. By default, it displays the names of the files and directories in a straightforward format.
					$ ls
file1.txt file2.txt directory1 directory2

You can also use various options with ls to get more information, such as file sizes, permissions, and timestamps.
2. cd : Changing Directories
The cd command is used to change directories. It allows you to navigate through the file system and access different directories.
					$ cd /path/to/directory
3. pwd : Present Working Directory
The pwd command displays the absolute path of the current working directory.
					$ pwd

4. mkdir : Creating Directories
The mkdir command creates a new directory with the specified name.
					$ mkdir new_directory

5. rmdir : Removing Directories
The `rmdir` command is used to remove empty directories.
					$ rmdir empty_directory

File Operations

6. touch : Creating Files
The touch command creates a new empty file with the specified name.
					$ touch new_file.txt
7. cp : Copying Files and Directories
The cp command is used to copy files or directories from one location to another.
					$ cp file.txt /path/to/destination/
8. mv : Moving or Renaming Files and Directories
The mv command moves files or directories from one location to another. It can also be used to rename files or directories.
					$ mv file.txt /path/to/destination/
$ mv old_name.txt new_name.txt
9. rm : Removing Files and Directorie
The rm command is used to remove files or directories. Use it with caution, as the data deleted by this command cannot be easily recovered.
					$ rm file.txt
$ rm -r directory/
10. cat : Displaying File Content
The `cat` command is used to display the contents of a file.
					$ cat file.txt
11. more and less : Viewing File Content Page by Page
The `more` and `less` commands allow you to view file content page by page, which is useful for large files.
					$ more large_file.txt
$ less large_file.txt

Text Processing

12. grep : Searching for Patterns in Files
The `grep` command is used to search for a specific pattern or text in a file.
					$ grep "keyword" file.txt
13. sed : Stream Editor for Text Manipulation
The `sed` command is a powerful stream editor that allows you to perform text manipulation based on regular expressions.
					$ echo "Hello, World!" | sed 's/Hello/Hi/'
14. awk : Text Processing and Data Extraction
The `awk` command is a versatile tool for text processing and data extraction. It processes text line by line and allows you to perform actions on specific columns.
					$ awk '{print $1}' data.txt


System Information

15. top : Monitoring System Processes
The `top` command provides real-time monitoring of system processes and resource usage.
					$ top

16. free : Checking Memory Usage
The `free` command displays the system’s free and used memory.
					$ free -h
17. df and du: Displaying Disk Space Information
The `df` command shows the disk space usage of file systems, while `du` shows the disk usage of directories.
					$ df -h
$ du -h
18. uname : Showing System Information
The `uname` command displays system information, such as the kernel version and system architecture.
					$ uname -a
19. ps : Displaying Process Status
The `ps` command provides information about currently running processes.
					$ ps aux

Package Management

20. apt and apt-get: Package Management on Debian-based Systems
`apt` and `apt-get` are package management tools used on Debian-based systems like Ubuntu.
					$ sudo apt update
$ sudo apt install package_name
21. yum : Package Management on Red Hat-based Systems
The `yum` command is used for package management on Red Hat-based systems like CentOS.
					$ sudo yum update
$ sudo yum install package_name
22. dnf: The Next-Generation Package Manager
`dnf` is a modern package manager used on newer versions of Fedora and CentOS.
					$ sudo dnf update
$ sudo dnf install package_name
23. pacman : Package Management on Arch Linux
`pacman` is the package manager used on Arch Linux and its derivatives.
					$ sudo pacman -Syu
$ sudo pacman -S package_name


24. ping : Checking Network Connectivity
The `ping` command is used to check network connectivity to a specific host.
					$ ping google.com
25. ifconfig and ip : Configuring Network Interfaces
`ifconfig` and `ip` commands are used to configure network interfaces on Linux systems.
					$ ifconfig
$ ip address show
26. ssh : Securely Accessing Remote Machines
The `ssh` command allows you to securely access remote machines over a network.
					$ ssh user@remote_host
27. scp : Copying Files Between Local and Remote Systems
The `scp` command is used to securely copy files between local and remote systems.
					$ scp file.txt user@remote_host:/path/to/destination/
28. curl and wget: Downloading Files from the Web
Both `curl` and `wget` commands can be used to download files from the internet.\.
					$ curl -O https://example.com/file.txt
$ wget https://example.com/file.txt

File Permissions

29. chmod : Changing File Permissions
The `chmod` command is used to change file permissions, which control read, write, and execute rights.
					$ chmod +x script.sh
30. chown : Modifying File Ownership
The `chown` command allows you to change the owner of a file.
					$ chown user file.txt
31. chgrp : Changing Group Ownership
The `chgrp` command is used to change the group ownership of a file.
					$ chgrp group file.txt

Compression and Archiving

32. tar: Creating and Extracting Tarballs
The `tar` command is used to create and extract tarballs, which are archive files.
					$ tar -cvf archive.tar file1 file2
$ tar -xvf archive.tar
33. gzip and gunzip : Compressing and Decompressing Files
`gzip` and `gunzip` are used to compress and decompress files.
					$ gzip file.txt
$ gunzip file.txt.gz

Process Management

34. kill and killall : Terminating Processes
The `kill` command is used to terminate processes by sending signals to them.
					$ kill process_id
$ killall process_name
35. bg and fg : Managing Background and Foreground Processes
The `bg` and `fg` commands allow you to manage background and foreground processes.
					$ bg
$ fg

Environment Variables

Environment variables are dynamic values that affect the behavior of processes in the shell.
37. Understanding Environment Variables
The `export` command is used to set environment variables.
					$ export VARIABLE_NAME=value
38. echo : Displaying the Value of Variables
The `echo` command displays the value of environment variables.
					$ echo $VARIABLE_NAME

Command History

39. history : Viewing Command History
The command history allows you to recall and reuse previously executed commands.
The `history` command displays a list of previously executed commands.
					$ history
40. Ctrl+R: Searching Command History
Pressing `Ctrl+R` allows you to search for a command in the command history.

Useful Utilities

41. date : Displaying or Setting the System Date and Time
The `date` command displays or sets the system date and time.
					$ date
$ sudo date MMDDhhmmYYYY
42. cal : Displaying a Calendar
The `cal` command displays a calendar for the current month.
					$ cal
43. bc : Command-Line Calculator
The `bc` command is a command-line calculator for performing mathematical calculations.
					$ echo "2+2" | bc


Congratulations! You have now explored a wide range of essential Linux commands that every developer should know. These commands will help you navigate the command line with ease, manage files and processes, and interact efficiently with your Linux-based development environment.
As you continue to work with the command line, you’ll discover even more commands and tricks that will enhance your productivity and effectiveness as a developer.
Remember to practice regularly and experiment with different commands to gain a deeper understanding of their capabilities. The command line might seem intimidating at first, but with time and practice, it will become an invaluable tool in your development toolkit.

Go Further!


The command line is a text-based interface in the terminal where users can interact with the operating system by typing commands.
The command line provides developers with direct access to the underlying system, making it efficient for performing various tasks and automating processes.
You can navigate directories using commands like cd (change directory) to move to a specific directory, ls to list files and directories in the current location, and pwd to display the present working directory.
To create a new directory, use the mkdir command followed by the desired directory name. For example: mkdir new_folder.
You can use the cp command to copy files, mv to move or rename files. For example: cp file.txt destination/ or mv file.txt new_name.txt.
The grep command is used to search for text patterns in files. For instance: grep ‘search_text’ file.txt.
You can use the cat command to display the entire content of a file or less command to view it page-by-page. For example: cat file.txt or less file.txt.
Linux distributions often have package managers like apt, yum, or dnf. Use commands like sudo apt-get install package_name (for Debian-based systems) or sudo yum install package_name (for Red Hat-based systems) to install packages.
You can use the top command to display real-time information about system resources, including CPU, memory, and processes.
To compress files, use commands like tar (for creating tar archives) and gzip (for compression). For example: tar -czvf archive.tar.gz folder/. To decompress, use tar -xzvf archive.tar.gz.
The shutdown command allows you to initiate system shutdown or restart. Use sudo shutdown -h now to shut down immediately or sudo reboot to restart the system.
Share the Post:
Scroll to Top