Some Linux cheatsheet commands 👾

  • Get all the info of your operating system

hostnamectl
  • Get the content of a .sh:

file file.sh
  • Get the PATH:

echo $PATH
  • Get the bash functions available:

declare -F
  • To count the results:

declare -f | wc -l
  • List a function definition:

type quote
  • Use a funtion:

quote bob
  • If you don't have Internet, try this:

sudo ifconfig eth0 up
sudo dhclient eth0
  • SUID:

    • Files with the SUID bit set when executed are run with the permissions of the owner of the file. So if there is an binary that is owned by root and it has the SUID bit set we could theoretically use this binary to elevate our permissions.

      To find SUID binaries, we can run the following command:

  • How to find any file:

  • Get the size of a file:

  • BASH math -> https://phoenixnap.com/kb/bash-math

  • ERROR: Unable to negotiate with X.X.X.X port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

  • To encrypt an external or internal hard drive or USB:

  • Compare the size of two remote files using ssh:

  • How to remove a package on linux:

  • How to upload files remotely via sftp:

  • Check your open ports:

  • Use the tool tac for printing files when cat, vi, vim... are blocked or not permitted:

  • Get everything of a website to obtain flags:

  • Locate any file with find:

  • Unzip a file on Linux using Python:

  • Transfer a file from remote host to yours using scp:

  • If the linux machine doesn't have wget, we can try:

Last updated