Categories
Linux

Linux Learnings

dave@mule:~$ arr=($(ipcs -p | awk -F ' *' '$3 ~ /^[0-9]+$/ {print $3}' ))
dave@mule:~$ for i in "${arr[@]}"; do :; ps aux | grep -v grep | grep -e $i; done

This code firstly creates an array of the 3rd column’s numerical values from the [ ipcs-p ] command and then in the second command it iterates over the array and filters out the [ps aux] results using [grep] to display only entries matching the item in the array.

It’s not terribly efficient but I’m just starting out here… 🙂

 

 

Categories
Linux

courses:edx.org

Handy Bash Shortcuts

Keyboard Shortcut Task
CTRL-L Clears the screen
CTRL-D Exits the current shell
CTRL-Z Puts the current process into suspended background
CTRL-C Kills the current process
CTRL-H Works the same as backspace
CTRL-A Goes to the beginning of the line
CTRL-W Deletes the word before the cursor
CTRL-U Deletes from beginning of line to cursor position
CTRL-E Goes to the end of the line
Tab Auto-completes files, directories, and binaries

Categories
Linux

courses.edx.org : bash and scripting linux

 

Character Description
# Used to add a comment, except when used as #, or as #!when starting a script
 \ Used at the end of a line to indicate continuation on to the next line
; Used to interpret what follows as a new command
$ Indicates what follows is a variable