Working in software development often means spending a lot of time in the terminal, especially on Linux systems. Mastering a few essential commands can significantly boost your productivity. Here’s a quick reference guide to some of the most useful ones.
Command Description Example Usage lsList directory contents ls -la (long format, all files)cdChange directory cd ../projects/my-apppwdPrint working directory pwdmkdirCreate directory mkdir new-featurermRemove files or directories rm -rf old-logs/ (force, recursive)cpCopy files or directories cp -r src/ build/mvMove or rename files/directories mv old-name.txt new-name.mdfindSearch for files in a directory hierarchy find . -name "*.js"
Command Description Example Usage catConcatenate and display file content cat README.mdlessView file content page by page less /var/log/syslogheadDisplay first N lines of a file head -n 10 config.yamltailDisplay last N lines of a file tail -f access.log (follow changes)grepSearch for patterns in files grep -r "error" . (recursive search)nano / vimText editors nano script.sh
Command Description Example Usage psReport a snapshot of current processes `ps aux top / htopDisplay Linux processes dynamically htop (more user-friendly)killSend a signal to processes kill 12345 (terminate process ID 12345)killallKill processes by name killall nodesystemctlControl the systemd system and service manager sudo systemctl status nginx
Command Description Example Usage dfReport file system disk space usage df -h (human-readable)duEstimate file space usage du -sh my-project/ (summary, human-readable)freeDisplay amount of free and used memory free -hunamePrint system information uname -a (all information)lscpuDisplay CPU architecture information lscpu
Command Description Example Usage ip addrDisplay IP addresses and network interfaces ip addr show eth0pingSend ICMP ECHO_REQUEST to network hosts ping google.comcurlTransfer data from or to a server curl -I https://codevibr.dev (show headers)wgetNon-interactive network downloader wget https://example.com/file.zipsshOpenSSH remote login client ssh user@remote-host
Understanding file permissions is crucial for security and proper application function.
# Change permissions (read, write, execute for owner, group, others)
sudo chown user:group my-file.sh
Command Description Example Usage apt updateRefresh package lists sudo apt updateapt upgradeUpgrade installed packages sudo apt upgrade -yapt installInstall new packages sudo apt install gitapt removeRemove packages sudo apt remove htop
While not strictly a Linux command, Git is indispensable for developers.
# Initialize a new repository
git clone https://github.com/user/repo.git
# Add changes to staging area
git commit -m "feat: add new feature"
This is just a starting point. The Linux terminal is a powerful environment, and there’s always more to learn. The best way to get comfortable is to use it daily. Experiment, read man pages (man <command>), and don’t be afraid to break things in a safe environment.
Happy coding!