Find out user's login history
|
|
$ zgrep username /var/log/auth.log*
|
|
Show date with YYYYDDMM format
|
|
$ date '+%Y%m%d'
|
|
Show real-time processes that the user owns
|
|
$ top -u username
|
|
Show real-time processes with command arguments
|
|
$ top -c
|
|
Display memory usage as the human-readable output
|
|
$ free -h
|
|
Check local network by ping localhost
|
|
$ ping 0
|
|
Disable the network Interface(e.g. eth0)
|
|
$ sudo ifconfig eth0 down
|
|
Find files larger than 100MB in the current directory
|
|
$ find . -size +100M
|
|
How to find largest files and directories in Linux
|
|
$ du -a | sort -n -r | head -n 15
|
|
Create a compressed tar.gz archive file archive.tar for a directory backup in current working directory
|
|
$ tar czvf archive.tar.gz ./backup/
|
|
How to POST JSON with curl
|
|
$ curl -X POST -H "Content-Type: application/json" -d '{"id": "1"}' localhost:3000/api/v1/users
|
|
How to DELETE JSON with curl
|
|
$ curl -X POST -H "Content-Type: application/json" -d '{"id": "1"}' localhost:3000/api/v1/users
|
|
How to GET JSON with basic authentication using curl
|
|
$ curl --basic -u $username:$password https://api.example.com/api/sample.json -H "accept: application/json"
|
|
Reverse port forwarding with ssh to access to my home PC through the proxy server
|
|
$ ssh -N -R :8000:localhost:22 username@proxy_server # at my home PC
|
|
Set permission to protects a file, foo.txt, against any access from other users, while the issuing user still has full access.
|
|
$ chmod 700 foo.txt
|
|
Show date with ISO8601 format
|
|
$ date --iso-8601="seconds"
|
|
Display memory usage as human readable format 3 times in 3 seconds interval
|
|
$ free -h -s 3 -c 3
|
|
Enable the network Interface(e.g. eth0)
|
|
$ sudo ifconfig eth0 up
|
|
Display the network settings of specific interface (e.g. eth0)
|
|
$ ifconfig eth0
|
|
Display all network setting
|
|
$ ifconfig
|
|
Perform a full-format listing of the process status
|
|
$ ps -ef
|
|
List subdirectories only n level[s] deep
|
|
$ find -maxdepth N
|
|
Execute a task as a background job specifying dyno size with rails runner on Heroku
|
|
$ heroku run:detached rails runner Tasks::MyTask.execute --app myapp --size=standard-2x
|
|
Lauch archlinux lxd image with lxc command
|
|
$ lxc launch images:archlinux/current/amd64 CONTAINER_NAME
|
|
How to search lxc images
|
|
$ lxc image list images: archlinux amd64
|
|
Run expo changing hostname to run remotely
|
|
$ REACT_NATIVE_PACKAGER_HOSTNAME=YOUR_HOST expo start
|
|
Copy a file from the other branch using git
|
|
$ git checkout my_other_branch a_file. # e.g. git checkout feature_branch app/models/user.rb
|
|
Show all migrations on Rails
|
|
$ rails db:migrate:status # or rake db:migrate:status
|
|
How to remove gitignored files from branch (bash)
|
|
$ git rm --cached `git ls-files -i -c --exclude-from=.gitignore`
|
|