100 Linux Commands for Every Day Use

Linux

Basic Commands

  1. pwd – Print the current working directory.
    • Example: pwd
  2. cd – Change the current directory.
    • Example: cd /home/user
  3. ls – List directory contents.
    • Example: ls -l
  4. cp – Copy files or directories.
    • Example: cp file.txt /home/user/backup/
  5. mv – Move/rename files or directories.
    • Example: mv oldname.txt newname.txt
  6. rm – Remove files or directories.
    • Example: rm file.txt
  7. mkdir – Create a new directory.
    • Example: mkdir newdir
  8. rmdir – Remove an empty directory.
    • Example: rmdir olddir
  9. touch – Create a new empty file or update the timestamp of an existing file.
    • Example: touch newfile.txt
  10. 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
  2. more – View file contents one screen at a time (less advanced than less).
    • Example: more file.txt
  3. head – Display the first lines of a file.
    • Example: head -n 10 file.txt
  4. tail – Display the last lines of a file.
    • Example: tail -n 10 file.txt
  5. nano – Simple text editor in the terminal.
    • Example: nano file.txt
  6. vim – Advanced text editor in the terminal.
    • Example: vim file.txt
  7. grep – Search text using patterns.
    • Example: grep "pattern" file.txt
  8. find – Search for files in a directory hierarchy.
    • Example: find /home/user -name "*.txt"
  9. diff – Compare files line by line.
    • Example: diff file1.txt file2.txt
  10. 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
  2. chown – Change file owner and group.
    • Example: chown user:group file.txt
  3. chgrp – Change group ownership.
    • Example: chgrp group file.txt

File Compression

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

System Monitoring

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

Networking

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

Disk Management

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

User Management

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

Package Management (Debian/Ubuntu)

  1. apt-get – APT package handling utility.
    • Example: apt-get update
  2. apt-cache – Query the APT cache.
    • Example: apt-cache search package
  3. dpkg – Debian package manager.
    • Example: dpkg -i package.deb
  4. 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
  2. rpm – RPM package manager.
    • Example: rpm -ivh package.rpm
  3. 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
  2. service – Run a System V init script.
    • Example: service service start
  3. shutdown – Halt, power-off or reboot the machine.
    • Example: shutdown -h now
  4. reboot – Reboot the system.
    • Example: reboot
  5. halt – Halt the system.
    • Example: halt
  6. init – Change runlevel.
    • Example: init 0

Archive and Backup

  1. rsync – Remote file and directory synchronization.
    • Example: rsync -av /source /destination
  2. 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
  2. sed – Stream editor for filtering and transforming text.
    • Example: sed 's/old/new/g' file.txt
  3. cut – Remove sections from each line of files.
    • Example: cut -d' ' -f1 file.txt
  4. sort – Sort lines of text files.
    • Example: sort file.txt
  5. uniq – Report or omit repeated lines.
    • Example: uniq file.txt
  6. tr – Translate or delete characters.
    • Example: tr 'a-z' 'A-Z' < file.txt
  7. paste – Merge lines of files.
    • Example: paste file1.txt file2.txt
  8. join – Join lines of two files on a common field.
    • Example: join file1.txt file2.txt
  9. 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
  2. blkid – Locate/print block device attributes.
    • Example: blkid
  3. df – Report file system disk space usage.
    • Example: df -h

System Logs

  1. dmesg – Print or control the kernel ring buffer.
    • Example: dmesg
  2. 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'
  2. unalias – Remove an alias.
    • Example: unalias ll
  3. env – Run a program in a modified environment.
    • Example: env VAR=value command
  4. printenv – Print all or part of environment.
    • Example: printenv PATH
  5. export – Set an environment variable.
    • Example: export PATH=/usr/local/bin:$PATH
  6. date – Display or set the system date and time.
    • Example: date "+%Y-%m-%d %H:%M:%S"
  7. cal – Display a calendar.
    • Example: cal
  8. whoami – Print effective user ID.
    • Example: whoami
  9. hostname – Show or set the system’s hostname.
    • Example: hostname
  10. clear – Clear the terminal screen.
    • Example: clear
  11. history – Show the command history. – Example: history

Leave a Reply