Linux Commands
Linux Commands
tar containing
# tar cf archive.tar directory
directory
# tar xzf archive.tar.gz Extract a gzip compressed tar file Show how long the system has been
# uptime
running + load
# tar cjf archive.tar.bz2 directory Create a tar file with bzip2 compression
SYSTEM INFORMATION
# yum search keyword Search for a package by keyword Show system host name # hostname
# tar xjf archive.tar.bz2 Extract a bzip2 compressed tar file
# yum install package Install package Show system reboot history # last reboot
HARDWARE INFORMATION
# apt-cache search keyword Search for a package by keyword
Display free and used memory (-h for human
# free -h
readable, -m for MB, -g for GB.)
# apt install package_name Install package
Display and manage the top processes # top
Display description and summary information Display DMI/SMBIOS (hardware info) from
# apt show package_name (DPM based distributions) # dmidecode Display processor related statistics # mpstat 1
about package the BIOS
# dpkg -i <package_name.deb> Install software from source code Display the last 100 syslog messages (Use /
# tail 100 /var/log/messages
PERFORMANCE MONITORING var/log/syslog for Debian based systems.)
AND STATISTICS
Linux
Remove (delete) file # rm file
Created by @0xCyberY
Delete the john account # userdel john Force removal of file without prompting for
# rm -f file
confirmation
Add the john account to the sales group # usermod -aG sales john
Synchronize files/directories between the Create symbolic link to linkname # ln -s /path/to/file linkname
# rsync -avz /home server:/backups/
local and remote system with
Kill process with process ID of pid # kill <PID> Display the first 10 lines of file # head file
Show free and used inodes on mounted
# df -i
filesystems
PROCESS MANAGEMENT Kill all processes named processname # kill <process name> Display the last 10 lines of file # tail file
u= User
To go up one level of the directory tree FILE PERMISSIONS Linux chmod example
# cd ..
(Change into the parent directory.)
g= Group
x = execute
s = setuid
# nano filename
NETWORKING Display DNS information for domain # dig <domain>