πŸ“œLinux Scroll

This page will feature Linux cheatsheets for quick reference when needed for various tasks. It will not include detailed information.

Knowing about a Command

man [COMMAND NAME]
whatis [COMMAND NAME]

Check your Current IP

ifconfig #eth0/wlan0
ip a s #eth0/wlan0

# Private IP
ip -br -c a

# Public IP
curl ip.me -- public

Misc.

uname -m #Find out the machine hardware name
echo $MAIL #path to a users mail
grep USERNAME /etc/passwd #which shell is specified for a user
ls -i /etc/sudoers #check the index number of the "sudoers" file in the "/etc" directory
ls -lt /var/backups #check the last modified file

#What is the name of the config file that has been created after 2020-03-03 and is smaller than 28k but larger than 25k?
find / -type f -name "*.conf" -newermt 2020-03-03 ! -size -25k ! -size +28k 2>/dev/null

#How many files exist on the system that have the ".bak" extension?
find / -type f -name "*.bak" 2>/dev/null | wc -l

List/Check TCP Connections

2>/dev/null

When you use 2>/dev/null, any error messages generated by the command are sent to /dev/null, effectively hiding or ignoring them.

  • 2> redirects the standard error output (which is represented by file descriptor 2).

  • /dev/null is a special file that discards any data written to it (essentially a "black hole").

Last updated