Recent Notes
Displaying keyword search results 1 - 10
Created by voodoo on January 03, 2012 08:41:21
Last update: February 16, 2012 15:50:06
This is the command to print all regular files in the src folder but excluding all files within the .svn folders:
$ find src -name .svn -prune -o -type f -print
where -o is the or operator.
Define a shortcut:
ff ()
{
find $1 -name .svn -prune -o -...
Created by voodoo on November 22, 2011 12:27:12
Last update: November 22, 2011 12:31:50
Unix hidden files are named starting with a dot ".".
To find hidden files in the current directory:
$ find . -type f -name '.*'
or
$ find . -type f | grep \\/\\.
To find hidden files in the marketing directory:
$ find marketing -type f -name '.*'
or
$ find marketing -type f | grep \\/\\.
Created by woolf on April 12, 2011 09:20:08
Last update: April 12, 2011 09:20:08
First try (this lists files by directory, including directories themselves):
ls -R -lrt
Second try:
find . -type f | xargs ls -lrt
Created by magnum on March 09, 2011 15:49:58
Last update: March 09, 2011 15:49:58
GNU cpio copies files into or out of a cpio or tar archive. There are 3 modes:
-o : copy-out mode, copies files into an archive
-i : copy-in mode, copies files out of an archive
-p : copy-pass mode, combines the copy-out and copy-in steps without actually using an archive
Examples:
# create a cpio archive with all files in the ...
Created by Dr. Xi on February 17, 2011 12:59:47
Last update: February 17, 2011 12:59:47
Operator Meaning -e file1 file1 exists -b file1 file1 is a block special file -c file1 file1 is a character special file -d file1 file1 is a directory -f file1 file1 is a regular -g file1 Set Group ID (sgid) bit is set for file1 -h file1 file1 is a symbolic link -k file1 Sticky bit is set for file1 -L file1 file1 is a symbolic link -p file1 file1 is a named pipe (FIFO) -r file1 file1 is readable by the current process -s file1 file1 has a size greater than zero. -t FileDescriptor FileDescriptor is open and associated with a terminal. -u file1 Set User ID (suid) bit is set for file1 -w file1 Write flag (w) is on for file1 -x file1...
Created by Dr. Xi on January 31, 2011 16:24:31
Last update: January 31, 2011 16:24:58
Perl file test operators are unary operators that takes one argument, which can be a file name, a filehandle, or dirhandle. If the argument is omitted, it tests $_ , except for -t , which tests STDIN. Syntax: -X FILEHANDLE -X EXPR -X DIRHANDLE -X where X is: Operator Meaning -r File is readable by effective uid/gid. -w File is writable by effective uid/gid. -x File is executable by effective uid/gid. -o File is owned by effective uid. -R File is readable by real uid/gid. -W File is writable by real uid/gid. -X File is executable by real uid/gid. -O File is owned by real uid. -e File exists. -z File has zero size (is empty). -s File has nonzero size (returns size in bytes)....
Created by magnum on June 23, 2010 20:42:12
Last update: June 23, 2010 20:52:33
Compile mod_proxy_html from source code.
Prerequisite: Apache httpd installed on system with header files.
Command:
# /usr/local/apache2/bin/apxs -i -c -I/usr/local/i...
Output:
/usr/local/apache2/build/libtool --silent --mode=c...
Created by voodoo on June 17, 2010 15:23:02
Last update: June 17, 2010 15:35:40
Use useradd to add a user (the switches are not required, but it's a good idea to give them. For example, without -m you'd create a user without a home directory):
# -d switch specifies user home directory
# -m ...
You also need to use the passwd command to set a new password before the user can log in.
To delete a user, use the userdel command:
userdel demo
Created by Dr. Xi on December 04, 2009 04:33:05
Last update: December 04, 2009 04:33:05
Variable Meaning $_ The default or implicit variable. @_ Within a subroutine the array @_ contains the parameters passed to that subroutine. $a, $b Special package variables when using sort() $<digit> Contains the subpattern from the corresponding set of capturing parentheses from the last pattern match, not counting patterns matched in nested blocks that have been exited already. $. Current line number for the last filehandle accessed. $/ The input record separator, newline by default. $| If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel. Default is 0 (regardless of whether the channel is really buffered by the system or not; $| tells you only whether you've asked Perl explicitly to flush after...
Created by voodoo on October 03, 2009 21:34:35
Last update: October 03, 2009 21:34:56
One liners:
Oldest
find . -printf "%T@ %Tx %TX %p\n" | sort -n | head...
Newest
find . -printf "%T@ %Tx %TX %p\n" | sort -n -r | h...
Shell scripts:
Oldest
#!/bin/ksh
touch -t $(($(date "+%Y") + 1))$(dat...
Newest
#!/bin/ksh
touch -t 197001010000 compareTo
N...