Linux Commands Cheat Sheet

This outputs your stuff in a folder called ‘packageName’:

tar -xvzf packageName.tar.gz

 


This can help tell you what version of linux or at least linux kernel you are running:

uname -a

 


Find a process and kill it:

Run this ‘ps’ command to find the process, in this case the MySQL Daemon “mysqld”.

ps -ax | grep mysqld

On a Mac, you will likely get output that looks like this:

  114 ??         3:59.55 /usr/local/mysql/bin/mysqld –user=_mysql –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data –plugin-dir=/usr/local/mysql/lib/plugin –log-error=/usr/local/mysql/data/mysqld.local.err –pid-file=/usr/local/mysql/data/mysqld.local.pid –port=3306

Then, run kill with the process ID of the process you wan to kill:

kill -9 processId

In this case:

kill -9 114

Edit/List Cron Jobs

crontab -e
crontab -l

Download file with curl (-o is the destination on your machine)

curl -o file.tar.gz https://example.com/file.tar.gz

Network/DNS inspection

dig google.com
nslookup google.com

Print all environment variables

printenv

 

Print one environment variable

echo $PATH

Leave a Reply

Your email address will not be published. Required fields are marked *