Tech.Linux History
Hide minor edits - Show changes to markup
top 10 process using the most memory:
Top 10 process using the most memory
(:sourceend:)
top 10 process using the most memory:
(:source lang=bash :) ps aux --sort=-%mem | awk 'NR<=10{print $0}'
It will list files having a size > 4000k in /.
It will list files having a size > 4000k in /.
List installed packages
(:source lang=bash :) dpkg -l | grep '^ii' (:sourceend:)
It will give the top ten of big folders sorted by size (in Mb) descending.
It will give the top ten of big folders sorted by size (in Mb) descending.
Find big files
(:source lang=bash :) find /-size +4000k -exec ls -lia {} \; (:sourceend:) It will list files having a size > 4000k in /.
Find big folders in a file system
(:source lang=bash :) du -hms /* | sort -nr | head (:sourceend:) It will give the top ten of big folders sorted by size (in Mb) descending.
It will forward all incoming data from localhost:2080 to webserver.org:80.
It will forward all incoming data from localhost:13306 to server.org:3306.
(:sourceend:)
List open ports
(:source lang=bash :) netstat -lnptu
find . -name Makefile | xargs grep pattern
(:source lang=bash :) find . -name Makefile | xargs grep pattern (:sourceend:)
(:sourceend:)
(:sourceend:)
How to search a pattern in a set of files
The best option is to use find to construct the set of files and then use grep.
find . -name Makefile | xargs grep pattern
ssh -L 2080:localhost:80 user@webserver.org
ssh -L 13306:localhost:3306 user@server.org
Some web servers are only available through a gateway. To access it from your computer, you can also use a SSH tunnel: (:source lang=bash :) ssh -L 8080:webserver:80 gw (:sourceend:)
How to set up an SSH tunnel?
(:source lang=bash :) ssh -L [tunnel-in-port]:[client-host]:[tunnel-out-port] [user@host-to-reach] (:sourceend:) Example: (:source lang=bash :) ssh -L 2080:localhost:80 user@webserver.org (:sourceend:) It will forward all incoming data from localhost:2080 to webserver.org:80.