Skip to content

Instantly share code, notes, and snippets.

@ZeccaLehn
Last active March 27, 2018 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZeccaLehn/6851b354df39df46f899a189db791a9a to your computer and use it in GitHub Desktop.
Save ZeccaLehn/6851b354df39df46f899a189db791a9a to your computer and use it in GitHub Desktop.
Useful Linux (Advanced)

Iterate over complete folder and open permissions

ls -l <directory>

chmod -R 777 .
stat -c %a mydir # Show chmod code of dir
stat mydir # Show stats of folder

Remove Directory

rm -r mydir

Unlock Home Folders

sudo chown -R $USER: $HOME

Assign a Variable and Echo to Console

varA = VariableA
echo "$varA"

To find the location of a command, use the "which" or "type" commands:

  $ which ifconfig
    /sbin/ifconfig
    
  $ type ifconfig
    ifconfig is /sbin/ifconfig

Firewall

sudo ufw enable
sudo ufw disable
sudo ufw status

Print Path

echo $HOME
echo $USER

Show IP and Node Status

lsof -iTCP -P -n

Download all files with respecitive folders

!tar chvfz notebook_files.tar.gz * --exclude notebook_files.tar.gz

All in one Linux update

sudo apt-get -y autoremove && sudo apt-get -y update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade

CRON Setup

crontab -e

* * * * * echo "Cron Worked $(date)" >> /tmp/cronworked.txt

Setup User

sudo useradd -m <your user> -p <your password>
sudo passwd <your password>
exit

# Login to ubuntu user
sudo login ubundu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment