Skip to content

Instantly share code, notes, and snippets.

@joonassandell
Last active November 3, 2016 09:13
Show Gist options
  • Save joonassandell/51e2c7f71a78c834a016c1890b89210f to your computer and use it in GitHub Desktop.
Save joonassandell/51e2c7f71a78c834a016c1890b89210f to your computer and use it in GitHub Desktop.
Random Debian etc. commands I usually forget
**Ubuntu version**:
`lsb_release -a`
**Amount of ram**:
`lshw -C memory`
**Switch to superuser**:
`sudo su`
**Show linux headers**:
`apt-cache search linux-headers-$(uname -r)`
**Update linux headers**:
`apt-get install linux-headers-generic`
**Show all packages**:
`dpkg --get-selections`
**Amount of space**:
`df -h`
**Find from apt-cache**:
`apt-cache search <something>`
**Find file**:
`find . -name '*.format'`
**Find folder**:
`find . -type d -name '.format'`
**Find files, remove them and their folders (Be careful)**:
`find /path/to/location/ -name '.format' -exec rm -rf {} \;`
**Find files and remove them (Be careful)**:
`find /path/to/location/ -type f -name "filesToFind" -exec rm -f {} \;`
**Set 644 CHMOD to files**:
`sudo find /path/to/location/ -type f -exec chmod 644 {} \;`
**Set 755 CHMOD to folders**:
`sudo find /path/to/location/ -type d -exec chmod 755 {} \;`
**Copy something recursively with SCP and use identity file**:
`sudo scp -i ~/.ssh/id_rsa -r my/folder user@domain:/my/server/folder`
**Sync folder with rsync and use identity file**:
`rsync -avzr --progress --stats -e "ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes" my/folder/ user@domain:/my/server/location`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment