Last active
October 11, 2019 14:19
-
-
Save gorshkov-leonid/397a8127a25173c806f4b89e1ff655f9 to your computer and use it in GitHub Desktop.
linux misc
This file contains hidden or 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
for num in {1..3}; do | |
mkdir "$num" | |
cd "$num" | |
git clone "https://aaa.git" . | |
cd ".." | |
done |
This file contains hidden or 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
#interfaces | |
ifconfig | |
#nettools | |
sudo apt install net-tools | |
#connection | |
watch -n 30 "netstat -nltup | awk '{print \$5}' | cut -d: -f1 | sort | uniq -c | sort -n" | |
watch -n 1 "netstat -nltup | sort" | |
#trafic | |
https://askubuntu.com/questions/257263/how-to-display-network-traffic-in-the-terminal | |
sudo tcptrack -i eth0 port 4411 | |
sudo tcptrack -i eth0 -r 10 port 4411 | |
#process name | |
ps -p 2053 -o comm= | |
### who has killed the process | |
dmesg | |
### memory allocated by processes | |
ps -o pid,user,%mem,command ax | sort -b -k3 -r | |
sudo pmap 1987 | tail -n 1 | awk '/[0-9]K/{print $2}' | |
ps -o rss,sz,vsz # resident set in kbytes; e.g., 2461016, # virtual size in kbytes; e.g., 1048 ... | |
###### Check 10 Top processes which are consuming RSS ( Resident Set Size ) | |
ps -e -orss,pid=,user=,args=, | sort -b -k1,1n | pr -TW$COLUMNS| tail -10 | |
#USS - Unique Set Size. This is the amount of unshared memory unique to that process (think of it as U for unique memory). It does not include shared memory. Thus this will under-report the amount of memory a process uses, but is helpful when you want to ignore shared memory. | |
#PSS - Proportional Set Size. This is what you want. It adds together the unique memory (USS), along with a proportion of its shared memory divided by the number of processes sharing that memory. Thus it will give you an accurate representation of how much actual physical memory is being used per process - with shared memory truly represented as shared. Think of the P being for physical memory. | |
#RSS - Resident Set Size. This is the amount of shared memory plus unshared memory used by each process. If any processes share memory, this will over-report the amount of memory actually used, because the same shared memory will be counted more than once - appearing again in each other process that shares the same memory. Thus it is fairly unreliable, especially when high-memory processes have a lot of forks - which is common in a server, with things like Apache or PHP(fastcgi/FPM) processes. | |
#Notice: smem can also (optionally) output graphs such as pie charts and the like. IMO you don't need any of that. If you just want to use it from the command line like you might use ps -A v, then you don't need to install the python-matplotlib recommended dependency. | |
#https://unix.stackexchange.com/questions/34795/correctly-determining-memory-usage-in-linux | |
#https://unix.stackexchange.com/questions/35129/need-explanation-on-resident-set-size-virtual-size | |
#https://unix.stackexchange.com/questions/151510/find-out-the-total-memory-allocated-for-a-particular-process-in-ubuntu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment