Skip to content

Instantly share code, notes, and snippets.

@danyaljj
Last active May 12, 2017 17:12
Show Gist options
  • Save danyaljj/5a25f1a02b8a492b463e to your computer and use it in GitHub Desktop.
Save danyaljj/5a25f1a02b8a492b463e to your computer and use it in GitHub Desktop.
terminal gist
Bash / Terminal / Shell notes
================================
* Script header
#!/bin/bash
* Decompression:
$ tar -zxvf filename.tgz
$ tar -zxvf filename.tar.gz
$ tar -jxvf filename.tar.bz2
gzip -d file.gz
* Search for string in files
grep -r 'something' path
* Search for file
find path -name "NAME"
* kill a process with its name
kill -9 PROCESS_NAME
* kill with application name:
killall Python
or
pkill AppName
* Show disk usage and usage limit
quota -s
-s is for human readibility.
* Remove contents of a folder recursively:
rm -rf folderName
* How to see whether you have permission to ssh on a git server or not (i.e. your public key has properly installed):
ssh -T [email protected]
* Redirect the output (stdout and strerr) to a file and output screen
command 2>&1 | tee filename
* Show permission of the files with permissions converted to human-readable numbers:
stat -c "%a %n" *
* Sort the list processes in `top` by their memory usage: `o` stands for override.
top -o %MEM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment