Check These Out
[Click the "show sample output" link to see how to use this keystroke.]
Meta-p is one of my all time most used and most loved features of working at the command line. It's also one that surprisingly few people know about. To use it with bash (actually in any readline application), you'll need to add a couple lines to your .inputrc then have bash reread the .inputrc using the bind command:
$ echo '"\en": history-search-forward' >> ~/.inputrc
$ echo '"\ep": history-search-backward' >> ~/.inputrc
$ bind -f ~/.inputrc
I first learned about this feature in tcsh. When I switched over to bash about fifteen years ago, I had assumed I'd prefer ^R to search in reverse. Intuitively ^R seemed better since you could search for an argument instead of a command. I think that, like using a microkernel for the Hurd, it sounded so obviously right fifteen years ago, but that was only because the older way had benefits we hadn't known about.
I think many of you who use the command line as much as I do know that we can just be thinking about what results we want and our fingers will start typing the commands needed. I assume it's some sort of parallel processing going on with the linguistic part of the brain. Unfortunately, that parallelism doesn't seem to work (at least for me) with searching the history. I realize I can save myself typing using the history shortly after my fingers have already started "speaking". But, when I hit ^R in Bash, everything I've already typed gets ignored and I have to stop and think again about what I was doing. It's a small bump in the road but it can be annoying, especially for long-time command line users. Usually M-p is exactly what I need to save myself time and trouble.
If you use the command line a lot, please give Meta-p a try. You may be surprised how it frees your brain to process more smoothly in parallel. (Or maybe it won't. Post here and let me know either way. ☺)
It grabs the PID's top resource users with $(ps -eo pid,pmem,pcpu| sort -k 3 -r|grep -v PID|head -10)
The sort -k is sorting by the third field which would be CPU. Change this to 2 and it will sort accordingly.
The rest of the command is just using diff to display the output of 2 commands side-by-side (-y flag) I chose some good ones for ps.
pidstat comes with the sysstat package(sar, mpstat, iostat, pidstat) so if you don't have it, you should.
I might should take off the timestamp... :|
Retrieve top ip threats from http://isc.sans.org/sources.html and add them into iptables output chain.
Sometimes it is handy to be able to list contents of a tar file within a compressed archive, such as 7Zip in this instance, without having to extract the archive first. This is especially helpful when dealing with larger sized files.
Change n directories up, without parameters change one up
A null operation with the name 'comment', allowing comments to be written to HISTFILE. Prepending '#' to a command will *not* write the command to the history file, although it will be available for the current session, thus '#' is not useful for keeping track of comments past the current session.
Get the time since epoch. Useful when working with commands and logs which use this format.
Get max number of arguments that can be accepted by the exec() system call.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"