Linux shell commands tips and tricks:
Keep in mind that for some commands you will need to install additional software on your Linux distribution.
SSH debug mode:
$ ssh -vvv user@ip_address
SSH with pem key:
$ ssh user@ip_address -i key.pem
Create war file:
$ jar -cvf name.war file
Test disk read speed:
$ hdparm -Tt /dev/sda
Get md5 hash from text:
$ echo -n "text" | md5sum
Check xml syntax:
$ xmllint --noout file.xml
Extract tar.gz in new directory:
$ tar zxvf package.tar.gz -C new_dir
Get HTTP headers with curl:
$ curl -I http://www.example.com
Modify timestamp of some file or directory (YYMMDDhhmm):
$ touch -t 0712250000 file
Download from ftp using wget:
$ wget -m ftp://username:password@hostname
Generate random password (16 char long in this case):
$ LANG=c < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;
Quickly create a backup of a file:
$ cp some_file_name{,.bkp}
Access Windows share:
$ smbclient -U "DOMAIN\user" //dc.domain.com/share/test/dir
Run command from history (here at line 200):
$ !200
Unzip to directory:
$ unzip package_name.zip -d dir_name
Show free RAM in MB:
$ free -m | grep cache | awk '/[0-9]/{ print $4" MB" }'
Git clone specific branch (master):
$ git clone git@github.com:name/app.git -b master
Git switch to another branch (develop):
$ git checkout develop
Git delete branch (mybranch):
$ git branch -d mybranch
Git delete remote branch:
$ git push origin :branchName
Git push new branch to remote:
$ git push -u origin mynewfeature
List all supported kill signals:
$ kill -l
No comments:
Post a Comment