Search This Blog

Thursday, January 27, 2011

find files which are modified in last 24 hours

find files which are modified in last 24 hours

  #find /path/to/ -type f -mtime -1

Special Variables in Linux

Special Variables in Linux

When variables are used they are referred to with the $ symbol in front of them. There are several useful variables available in the shell program. Here are a few:
  • $$ = The PID number of the process executing the shell.
  • $? = Exit status variable.
  • $0 = The name of the command you used to call a program.
  • $1 = The first argument on the command line.
  • $2 = The second argument on the command line.
  • $n = The nth argument on the command line.
  • $* = All the arguments on the command line.
  • $# The number of command line arguments.
The "shift" command can be used to shift command line arguments to the left, ie $1 becomes the value of $2, $3 shifts into $2, etc. The command, "shift 2" will shift 2 places meaning the new value of $1 will be the old value of $3 and so forth.

Tuesday, January 18, 2011

Command to find & delete files in linux

Command to find & delete files in linux

find /path/ -type f -exec /bin/rm -f '{}' \;

Tuesday, January 11, 2011

Linux command to tar with --exclude option

tar zcf ~/xxxx.tgz --exclude='archive/*' --exclude='something-*-test-*' folder/

Tuesday, January 4, 2011

Command to find list of externals in a SVN repository

Command to find list of externals in a SVN repository

svn propget svn:externals http://svn.xxxx.com/