TimeLinux1

Thursday, September 30, 2010

Linux HowTo: Useful Shell Commands - 1

Here is a little compilation of useful shell commands. The first in the series. More posts will follow in the same vein..
===
-Processes:

       # ps -ef                                         - every process and full output
       # ps -fu mrinal                              - full output of processes running as user mrinal

-Sessions:
 
        # id -un                                        - Currently logged in user
        # last mrinal                                - Last time user mrinal logged in
        # ls -A                                          - List All files but not . or ..
-Files:
         # find . -mmin -30                       - Find files modified in last 30 min; +30 = more than 30 min ago
         # find . -ls | sort -nrk7                 - Find and sort by size
         #tac afile                                     - outputs  afile in reverse order ( opposite of cat ).
         #od                                             - dump of a file ( default is octal dump, thats why od)
         # od -An file                                - A=marks the type of dump denoted by n. n can be o (octal), d (decimal), x (hex)
         #pr   afile                                    - format afile for print [ adds a default header - date time, filename and page number ]
         #nl   afile                                    - numbers the lines of afile in the output
         #ls -lu afile                                  - reports last access time of afile

 


No comments:

Post a Comment