awk: Text processing and pattern matching.
awk '/pattern/ {action}' filename
sed: Stream editing for transforming text.
sed -i 's/old/new/g' filename
grep: Searches for patterns in text.
grep -P '^a.*z$' filename
tcpdump: Captures and analyzes network packets.
tcpdump -i eth0 'port 80'
netstat: Displays network connections, routing tables, and statistics.
netstat -tulpn
iptables: Manages Linux firewall rules.
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
systemctl: Controls the systemd system and service manager.
systemctl status nginx
strace: Traces system calls and signals.
strace -c ls
lsof: Lists open files and the processes that opened them.
lsof -i :22
rsync: Efficient file copying and synchronization.
rsync -avz /src/ /dest/
perf: Performance analyzing tool.
perf stat -B dd if=/dev/zero of=/dev/null count=1000000
vmstat: Reports virtual memory statistics.
vmstat 1
sar: System activity reporter.
sar -u 1 3
ss: Investigates sockets.
ss -tulwn
find: Searches for files in a directory hierarchy.
find / -type f -name 'config.php' -exec chmod 644 {} \;
nmap: Network exploration and security auditing.
nmap -A -T4 target_ip
htop: Interactive process viewer.
htop
iostat: Monitors system input/output device loading.
iostat -mx 2
dstat: Versatile tool for generating system resource statistics.
dstat -cdngy 5 20
iftop: Displays bandwidth usage on an interface.
iftop -i eth0
ip: Shows and manipulates routing, devices, policy routing, and tunnels.
ip addr show
dig: DNS lookup.
dig +trace yourdomain.com
watch: Executes a program periodically, showing output.
watch -n 2 'df -h'
crontab: Manages a cron table for scheduling tasks.
crontab -e
mdadm: Manages MD (multi-disk) devices for RAID arrays.
mdadm --detail /dev/md0
chroot: Changes the root directory.
chroot /path/to/new/root
GnuPG: Encrypts and signs data.
gpg --encrypt --recipient name@example.com file.txt
traceroute: Traces the route packets take to a network host.
traceroute google.com
journalctl: Queries the systemd journal.
journalctl -u nginx.service --since yesterday
nmcli: NetworkManager command-line tool.
nmcli dev status
firewall-cmd: Manages firewalld settings.
firewall-cmd --list-all
bpftrace: Traces Linux kernel using BPF.
bpftrace -e 'tracepoint:syscalls:sys_enter_* { @[probe] = count(); }'
fail2ban: IP banning to protect against brute-force attacks.
fail2ban-client status sshd
ipset: Creates IP collections for use with iptables.
ipset create test hash:ip
iotop: Monitors I/O usage by processes.
iotop -o
mtr: Network diagnostic tool.
mtr myserver.com
glances: System monitoring tool.
glances
ncdu: Disk usage analyzer with an ncurses interface.
ncdu /path/to/directory
dd: Convert and copy a file.
dd if=/dev/zero of=/dev/sda bs=1M count=1024
fuser: Identify processes using files or sockets.
fuser -uv /path/to/file
kdump: Kernel crash dumping mechanism.
systemctl status kdump
parted: Disk partitioning and resizing tool.
parted -l
lsblk: List information about block devices.
lsblk
pv: Monitor the progress of data through a pipeline.
pv data.file | gzip > data.file.gz
mount: Mount a filesystem.
mount /dev/sda1 /mnt
umount: Unmount file systems.
umount /mnt
renice: Alter priority of running processes.
renice +10 -p 1234
at: Schedule commands to be executed at a particular time.
echo "echo hello" | at now + 1 minute
scp: Secure copy of files over the network.
scp localfile user@remote:/path
tar: Archive files into a tape archive (tar) format.
tar -czvf archive.tar.gz /path/to/directory
curl: Tool to transfer data from or to a server.
curl -O http://example.com/file.zip
wget: Non-interactive network downloader.
wget http://example.com/file.zip
ssh: Secure Shell, a protocol for secure remote login and other secure network services.
ssh user@host
scp: Secure copy (remote file copy program).
scp file.txt user@host:/path
rsnapshot: Local and remote filesystem snapshot utility.
rsnapshot daily
vim: Highly configurable text editor.
vim filename
nano: Easy-to-use text editor.
nano filename
git: Distributed version control system.
git clone https://github.com/user/project.git
screen: Full-screen window manager that multiplexes a physical terminal.
screen -S session_name
tmux: Terminal multiplexer, lets you switch easily between several programs in one terminal.
tmux new -s session_name
ansible: Automation tool for software provisioning, configuration management, and application deployment.
ansible all -m ping
terraform: Tool for building, changing, and versioning infrastructure safely and efficiently.
terraform apply
docker: Platform for developers and sysadmins to develop, deploy, and run applications with containers.
docker run --name web -p 8080:80 nginx
kubectl: Command line tool for controlling Kubernetes clusters.
kubectl get pods
helm: Kubernetes package manager.
helm install my-release mychart
ufw: Uncomplicated Firewall, frontend for iptables.
ufw allow from 192.168.1.1 to any port 22
fail2ban-client: Interface to Fail2Ban.
fail2ban-client status
apachectl: Control interface for Apache HTTP server.
apachectl status
mysql: Command-line tool for managing MySQL databases.
mysql -u root -p
pg_dump: Backup database utility for PostgreSQL.
pg_dump -U user dbname > outfile
top: Displays Linux processes.
top
ps: Reports a snapshot of the current processes.
ps aux
kill: Send a signal to a process.
kill -9 1234
killall: Kill processes by name.
killall nginx
nohup: Run a command immune to hangups, with output to a non-tty.
nohup command &
du: Disk usage statistics.
du -sh /path/to/directory
df: Report file system disk space usage.
df -h
free: Display amount of free and used memory in the system.
free -m
ln: Make links between files.
ln -s target link_name
chmod: Change file mode bits.
chmod +x script.sh
chown: Change file owner and group.
chown user:group file
useradd: Create a new user or update default new user information.
useradd -m username
usermod: Modify a user account.
usermod -aG sudo username
userdel: Delete a user account and related files.
userdel username
groupadd: Create a new group.
groupadd groupname
groupdel: Delete a group.
groupdel groupname
hostnamectl: Control the system hostname.
hostnamectl set-hostname newname
locale: Get or set system locale and related settings.
locale -a
date: Display or set system date and time.
date
uptime: Tell how long the system has been running.
uptime
who: Show who is logged on.
who
w: Show who is logged on and what they are doing.
w
last: Show listing of last logged in users.
last
mount: Mount a filesystem.
mount /dev/sda1 /mnt
umount: Unmount file systems.
umount /mnt
reboot: Reboot the system.
reboot
shutdown: Bring the system down.
shutdown -h now
history: Show command history.
history
alias: Create or remove aliases.
alias ll='ls -l'
unalias: Remove alias definitions. -
unalias ll
Sunday, April 21, 2024
100 Essential Commands Every Expert Linux Administrator Should Know
100 Essential Commands Every Expert Linux Administrator Should Know
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment