Last active
December 16, 2016 02:22
-
-
Save phuongtailtranminh/2d03d5855d85f5906079015ee3fe5ba1 to your computer and use it in GitHub Desktop.
Linux&OSX System Commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get the system information (OS version): cat /etc/*-release | |
Lists open files and the corresponding processes: lsof -i :port | |
Get PID of the process which is running on specific port: netstat -nlp | grep "port" | |
Get the path of specific PID: ps -fp pid | |
Get the public ip: curl httpbin.org/ip | |
Read Realtime log: tailf /path/to/file | |
Get directory structure: tree /directory | |
Move to previous directory: cd - (actually it is $OLDPWD environment path) | |
Copy ssh public key to server: ssh-copy-id user@ip_address | |
Execute a command repeatedly: watch 'command' | |
Get the latest log: ls -larht | |
Manipulate compressed file with: zcat, zgrep, zless | |
Check if process is running: ps -ef | grep "process name" | |
Random password: openssl rand -base64 15 | |
Chown with DEFAULT group: chown ownername: /path OR chown ownername. /path | |
Check the different: vimdiff /etc/nginx/{nginx.conf,nginx.conf.org} | |
Watch with alias: alias watch='watch ' | |
Customize Login Screen Path (Ubuntu): cd /etc/update-motd.d/ --> place new login screen into here. | |
Customize Login Screen (CentOS): vi /etc/ssh/sshd_config --> PrintMotd no --> place new login screen to: /etc/profile.d/ --> restart | |
siege – An HTTP/HTTPS stress load tester | |
ag - the silver searcher - faster than ack | |
scp - daily task copy over network | |
rsync - save bandwidth copy over network | |
tldr - useful version of "man" | |
brew - package manager for OSX | |
multitail - multiple log windows | |
==================================== | |
Number Of Available Port: | |
$OPENPORTS = netstat -an | grep ESTABLISHED | wc -l | |
cat /proc/sys/net/ipv4/ip_local_port_range => 32768 61000 | |
=> Available Ports = 61000 - 32768 - $OPENPORTS | |
==================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment