Linux Cheat Sheet
Linux Cheat Sheet
#uname -a =>Displaylinux system information #chmod octal file-name =>Change the permissions of file to octal
#uname -r =>isplay kernel release information Example
#uptime =>Show how long the system has been running + load #chmod 777 /data/test.c =>Set rwx permission for owner,group,world
#hostname =>Show system host name #chmod 755 /data/test.c =>Set rwx permission for owner,rw for group
#hostname -i =>Display the IP address of the host and world
#last reboot =>Show system reboot history #chown owner-user file =>Change owner of the file
#date =>Show the current date and time #chown owner-user:owner-group file-name =>Change owner and group
#cal =>Show this month calendar owner of the file
#w =>Display who is online #chown owner-user:owner-group directory =>Change owner and group
#whoami =>Who you are logged in as owner of the directory
#finger user =>Display information about user
NETWORK
HARDWARE
#ifconfig –a =>Display all network ports and ip address
#dmesg =>Detected hardware and boot messages #ifconfig eth0 =>Display specific ethernet port
#cat /proc/cpuinfo =>CPU model #ethtool eth0 =>Linux tool to show ethernet status
#cat /proc/meminfo =>Hardware memory #mii-tool eth0 =>Linux tool to show ethernet status
#cat /proc/interrupts =>Lists the number of interrupts per CPU per I/O device #ping host =>Send echo request to test connection
#lshw =>Displays information on hardware configuration of #whois domain =>Get who is information for domain
the system #dig domain =>Get DNS information for domain
#lsblk =>Displays block device related information in Linux #dig -x host =>Reverse lookup host
#free -m =>Used and free memory (-m for MB) #host google.com =>Lookup DNS ip address for the name
#lspci -tv =>Show PCI devices #hostname –i =>Lookup local ip address
#lsusb -tv =>Show USB devices #wget file =>Download file
#dmidecode =>Show hardware info from the BIOS #netstat -tupl =>List active connections to / from system
#hdparm -i /dev/sda =>Show info about disk sda
#hdparm -tT /dev/sda =>Do a read speed test on disk sda COMPRESSION / ARCHIVES
#badblocks -s /dev/sda =>Test for unreadable blocks on disk sda
#tar cf home.tar home =>Create tar named home.tar containing home/
USERS #tar xf file.tar =>Extract the files from file.tar
#tar czf file.tar.gz files =>Create a tar with gzip compression
#id =>Show the active user id with login and group #gzip file =>Compress file and renames it to file.gz
#last =>Show last logins on the system
#who =>Show who is logged on the system INSTALL PACKAGE
#groupadd admin =>Add group "admin"
#useradd -c "Sam Tomshi" =>g admin -m sam #Create user "sam" #rpm -i pkgname.rpm =>Install rpm based package
#userdel sam =>Delete user sam #rpm -e pkgname =>Remove package
#adduser sam =>Add user "sam"
#usermod =>Modify user information INSTALL FROM SOURCE