Powered by AI
Top most usable Linux daily use command
Copilot
Sure! Here are the top 100 Linux commands for administrators, along with their usage
and examples:
File and Directory Management
1. ls: Lists files and directories.
ls -l
2. cd: Changes the current directory.
cd /path/to/directory
3. pwd: Prints the current working directory.
pwd
4. cp: Copies files or directories.
cp source_file destination_file
5. mv: Moves or renames files or directories.
mv old_name new_name
6. rm: Removes files or directories.
rm file_name
7. mkdir: Creates a new directory.
mkdir new_directory
8. rmdir: Removes an empty directory.
rmdir directory_name
9. touch: Creates an empty file or updates the timestamp of an existing file.
touch file_name
10. find: Searches for files and directories.
find /path -name "file_name"
File Permissions and Ownership
1. chmod: Changes file permissions.
chmod 755 file_name
2. chown: Changes file owner and group.
chown user:group file_name
3. chgrp: Changes group ownership.
chgrp group_name file_name
System Information
1. uname: Displays system information.
uname -a
2. top: Displays real-time system information and processes.
top
3. htop: An interactive process viewer.
htop
4. df: Reports file system disk space usage.
df -h
5. du: Estimates file space usage.
du -sh /path/to/directory
6. free: Displays memory usage.
free -m
7. uptime: Shows how long the system has been running.
uptime
Network Management
1. ifconfig: Configures network interfaces.
ifconfig
2. ip: Shows/manages routing, devices, policy routing, and tunnels.
ip addr show
3. ping: Checks network connectivity.
ping google.com
4. netstat:
Displays network connections, routing tables, interface statistics,
masquerade connections, and multicast memberships.
netstat -tuln
5. ss: Another utility to investigate sockets.
ss -tuln
6. traceroute: Traces the route packets take to a network host.
traceroute google.com
7. nslookup: Queries DNS to obtain domain name or IP address mapping.
nslookup google.com
8. dig: Another DNS query tool.
dig google.com
9. wget: Downloads files from the web.
wget http://example.com/file
10. curl: Transfers data from or to a server.
curl http://example.com
User Management
1. useradd: Adds a new user.
useradd username
2. usermod: Modifies a user account.
usermod -aG groupname username
3. userdel: Deletes a user account.
userdel username
4. passwd: Changes a user’s password.
passwd username
5. groupadd: Adds a new group.
groupadd groupname
6. groupdel: Deletes a group.
groupdel groupname
7. groups: Shows the groups a user is a member of.
groups username
Process Management
1. ps: Reports a snapshot of current processes.
ps aux
2. kill: Sends a signal to a process.
kill PID
3. killall: Kills processes by name.
killall process_name
4. pkill: Sends a signal to processes based on name and other attributes.
pkill process_name
5. bg: Resumes suspended jobs in the background.
bg job_id
6. fg: Brings a background job to the foreground.
fg job_id
7. jobs: Lists active jobs.
jobs
Disk Management
1. fdisk: Manipulates disk partition table.
fdisk /dev/sda
2. mkfs: Builds a Linux file system.
mkfs.ext4 /dev/sda1
3. mount: Mounts a file system.
mount /dev/sda1 /mnt
4. umount: Unmounts a file system.
umount /mnt
5. fsck: Checks and repairs a Linux file system.
fsck /dev/sda1
6. blkid: Finds or displays block device attributes.
blkid
Package Management
1. apt-get: APT package handling utility (Debian-based).
apt-get update
2. yum: Package manager for RPM-based distributions.
yum install package_name
3. dnf: Next-generation package manager for RPM-based distributions.
dnf install package_name
4. rpm: RPM package manager.
rpm -ivh package_name.rpm
5. dpkg: Debian package manager.
dpkg -i package_name.deb
System Monitoring
1. vmstat: Reports virtual memory statistics.
vmstat
2. iostat: Reports CPU and I/O statistics.
iostat
3. sar: Collects, reports, or saves system activity information.
sar -u 1 3
4. dstat: Versatile resource statistics.
dstat
5. glances: Cross-platform monitoring tool.
glances
Log Management
1. tail: Outputs the last part of files.
tail -f /var/log/syslog
2. head: Outputs the first part of files.
head -n 20 file_name
3. less: Views file contents one screen at a time.
less file_name
4. more: Views file contents one screen at a time.
more file_name
5. cat: Concatenates and displays file contents.
cat file_name
6. logrotate: Rotates, compresses, and mails system logs.
logrotate /etc/logrotate.conf
Compression and Archiving
1. tar: Archives files.
tar -cvf archive_name.tar directory_name
2. gzip: Compresses files.
gzip file_name
3. gunzip: Decompresses files.
gunzip file_name.gz
4. zip: Packages and compress