100 Linux Commands for Every Day Use

Aditya Bhuyan
5 min readJun 23, 2024

--

Basic Commands

  1. pwd – Print the current working directory.
  • Example: pwd
  1. cd – Change the current directory.
  • Example: cd /home/user
  1. ls – List directory contents.
  • Example: ls -l
  1. cp – Copy files or directories.
  • Example: cp file.txt /home/user/backup/
  1. mv – Move/rename files or directories.
  • Example: mv oldname.txt newname.txt
  1. rm – Remove files or directories.
  • Example: rm file.txt
  1. mkdir – Create a new directory.
  • Example: mkdir newdir
  1. rmdir – Remove an empty directory.
  • Example: rmdir olddir
  1. touch – Create a new empty file or update the timestamp of an existing file.
  • Example: touch newfile.txt
  1. cat – Concatenate and display file contents.
  • Example: cat file.txt

File Viewing

  1. less – View file contents one screen at a time.
  • Example: less file.txt
  1. more – View file contents one screen at a time (less advanced than less).
  • Example: more file.txt
  1. head – Display the first lines of a file.
  • Example: head -n 10 file.txt
  1. tail – Display the last lines of a file.
  • Example: tail -n 10 file.txt
  1. nano – Simple text editor in the terminal.
  • Example: nano file.txt
  1. vim – Advanced text editor in the terminal.
  • Example: vim file.txt
  1. grep – Search text using patterns.
  • Example: grep "pattern" file.txt
  1. find – Search for files in a directory hierarchy.
  • Example: find /home/user -name "*.txt"
  1. diff – Compare files line by line.
  • Example: diff file1.txt file2.txt
  1. wc – Word, line, character, and byte count.
  • Example: wc file.txt

File Permissions

  1. chmod – Change file modes or Access Control Lists.
  • Example: chmod 755 script.sh
  1. chown – Change file owner and group.
  • Example: chown user:group file.txt
  1. chgrp – Change group ownership.
  • Example: chgrp group file.txt

File Compression

  1. tar – Archive files.
  • Example: tar -czvf archive.tar.gz /path/to/dir
  1. zip – Compress files into a zip archive.
  • Example: zip archive.zip file1 file2
  1. unzip – Extract files from a zip archive.
  • Example: unzip archive.zip
  1. gzip – Compress files with gzip.
  • Example: gzip file.txt
  1. gunzip – Decompress gzip files.
  • Example: gunzip file.txt.gz
  1. bzip2 – Compress files with bzip2.
  • Example: bzip2 file.txt
  1. bunzip2 – Decompress bzip2 files.
  • Example: bunzip2 file.txt.bz2

System Monitoring

  1. top – Display system tasks.
  • Example: top
  1. htop – Interactive process viewer.
  • Example: htop
  1. ps – Report a snapshot of current processes.
  • Example: ps aux
  1. df – Report file system disk space usage.
  • Example: df -h
  1. du – Estimate file space usage.
  • Example: du -sh /home/user
  1. free – Display memory usage.
  • Example: free -h
  1. uptime – Tell how long the system has been running.
  • Example: uptime
  1. who – Show who is logged on.
  • Example: who
  1. uname – Print system information.
  • Example: uname -a
  1. iostat – Report CPU and I/O statistics.
  • Example: iostat

Networking

  1. ping – Send ICMP ECHO_REQUEST to network hosts.
  • Example: ping google.com
  1. ifconfig – Configure a network interface.
  • Example: ifconfig eth0
  1. ip – Show/manipulate routing, devices, policy routing, and tunnels.
  • Example: ip addr show
  1. netstat – Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
  • Example: netstat -tuln
  1. ss – Another utility to investigate sockets.
  • Example: ss -tuln
  1. wget – Non-interactive network downloader.
  1. curl – Transfer data from or to a server.
  1. scp – Secure copy (remote file copy program).
  • Example: scp file.txt user@remote:/path/to/dest/
  1. ssh – OpenSSH SSH client (remote login program).
  • Example: ssh user@remote
  1. ftp – File Transfer Protocol client.
  • Example: ftp ftp.example.com

Disk Management

  1. fdisk – Partition table manipulator for Linux.
  • Example: fdisk /dev/sda
  1. mkfs – Build a Linux file system.
  • Example: mkfs.ext4 /dev/sda1
  1. mount – Mount a file system.
  • Example: mount /dev/sda1 /mnt
  1. umount – Unmount a file system.
  • Example: umount /mnt
  1. fsck – File system consistency check and repair.
  • Example: fsck /dev/sda1

User Management

  1. useradd – Create a new user.
  • Example: useradd newuser
  1. userdel – Delete a user account and related files.
  • Example: userdel newuser
  1. usermod – Modify a user account.
  • Example: usermod -aG sudo newuser
  1. passwd – Update a user’s authentication tokens.
  • Example: passwd newuser
  1. groupadd – Create a new group.
  • Example: groupadd newgroup

Package Management (Debian/Ubuntu)

  1. apt-get – APT package handling utility.
  • Example: apt-get update
  1. apt-cache – Query the APT cache.
  • Example: apt-cache search package
  1. dpkg – Debian package manager.
  • Example: dpkg -i package.deb
  1. aptitude – High-level interface to the package manager.
  • Example: aptitude install package

Package Management (Red Hat/CentOS)

  1. yum – Package manager for RPM-based distributions.
  • Example: yum install package
  1. rpm – RPM package manager.
  • Example: rpm -ivh package.rpm
  1. dnf – Modernized package manager for RPM-based distributions.
  • Example: dnf install package

System Control

  1. systemctl – Control the systemd system and service manager.
  • Example: systemctl start service
  1. service – Run a System V init script.
  • Example: service service start
  1. shutdown – Halt, power-off or reboot the machine.
  • Example: shutdown -h now
  1. reboot – Reboot the system.
  • Example: reboot
  1. halt – Halt the system.
  • Example: halt
  1. init – Change runlevel.
  • Example: init 0

Archive and Backup

  1. rsync – Remote file and directory synchronization.
  • Example: rsync -av /source /destination
  1. dd – Convert and copy a file.
  • Example: dd if=/dev/sda of=/dev/sdb

Text Processing

  1. awk – Pattern scanning and processing language.
  • Example: awk '{print $1}' file.txt
  1. sed – Stream editor for filtering and transforming text.
  • Example: sed 's/old/new/g' file.txt
  1. cut – Remove sections from each line of files.
  • Example: cut -d' ' -f1 file.txt
  1. sort – Sort lines of text files.
  • Example: sort file.txt
  1. uniq – Report or omit repeated lines.
  • Example: uniq file.txt
  1. tr – Translate or delete characters.
  • Example: tr 'a-z' 'A-Z' < file.txt
  1. paste – Merge lines of files.
  • Example: paste file1.txt file2.txt
  1. join – Join lines of two files on a common field.
  • Example: join file1.txt file2.txt
  1. tee – Read from standard input and write to standard output and files.
  • Example: echo "Hello" | tee file.txt

Disk Usage

  1. lsblk – List information about block devices.
  • Example: lsblk
  1. blkid – Locate/print block device attributes.
  • Example: blkid
  1. df – Report file system disk space usage.
  • Example: df -h

System Logs

  1. dmesg – Print or control the kernel ring buffer.
  • Example: dmesg
  1. journalctl – Query and display messages from the journal.
  • Example: journalctl -xe

Miscellaneous

  1. alias – Create an alias for a command.
  • Example: alias ll='ls -l'
  1. unalias – Remove an alias.
  • Example: unalias ll
  1. env – Run a program in a modified environment.
  • Example: env VAR=value command
  1. printenv – Print all or part of environment.
  • Example: printenv PATH
  1. export – Set an environment variable.
  • Example: export PATH=/usr/local/bin:$PATH
  1. date – Display or set the system date and time.
  • Example: date "+%Y-%m-%d %H:%M:%S"
  1. cal – Display a calendar.
  • Example: cal
  1. whoami – Print effective user ID.
  • Example: whoami
  1. hostname – Show or set the system’s hostname.
  • Example: hostname
  1. clear – Clear the terminal screen.
  • Example: clear
  1. history – Show the command history. – Example: history

--

--

Aditya Bhuyan

I am a cloud practitioner with expertise in many SAAS, PAAS offerings. I have worked as an architect and developer for many paas and saas products.