Tuesday 7 July 2015

Unix/Linux - Must Know Hacks

This post is a reference post for me to look back on important and most used hacks in Unix world. As unix/linux is bread and butter for any developer like me, it could be handy for others also.

For unix hacks which i came across during my work, i am listing the subject and link/links which provide solution to problem. Kudos to all the linux administrators and techies whose contributions have made life easier for other developers.

1. How to automatically start services on boot?
http://www.abhigupta.com/2010/06/how-to-auto-start-services-on-boot-in-centos-redhat/

2. How to unlist a service from automatic start on boot?
http://www.abhigupta.com/2010/06/how-to-auto-start-services-on-boot-in-centos-redhat/

3. How to run a long-running process detached from session(keeping it running even after closing the session) and attached it later to session?
http://www.thegeekstuff.com/2010/07/screen-command-examples/
http://www.tecmint.com/screen-command-examples-to-manage-linux-terminals/

4. Sticky bit in Unix File permission
https://en.wikipedia.org/wiki/Sticky_bit
http://www.thegeekstuff.com/2013/02/sticky-bit/

5. VI/VIM Cheatsheet

move to start of file                                      1G/gg
move to end of file                                       G
move to nth line of file                                 nG (for ex, 100G to move to line no 100)

6. Unix Special Variables

$#                        Stores the number of command-line arguments that
                            were passed to the shell program.
$?                         Stores the exit value of the last command that was
                            executed.
$0                        Stores the first word of the entered command (the
                            name of the shell program).
$*                        Stores all the arguments that were entered on the
                           command line ($1 $2 ...).
"$@"                    Stores all the arguments that were entered
                           on the command line, individually quoted ("$1" "$2" ...).


No comments:

Post a Comment