Saturday, March 15, 2014

8:24 PM
Good day!

Hello and welcome to another article on my howto; this time we will learn the basics on how to use the find and cat commands effectively on *nix. This commands are the most frequently used when working on terminal/shell.



cat

Concatenate FILE(s), or standard input, to standard output. Frequently used to display text on terminal, copy text file, combine text file, overwrite text file, and create text files.

usage          :    cat [options] [files]

options      :


             -A, --show-all                         equivalent to -vET
             -b, --number-nonblank    number nonempty output lines, overrides -n
             -e                                              equivalent to -vE
             -E, --show-ends                   display $ at end of each line
             -n, --number                        number all output lines
             -s, --squeeze-blank            suppress repeated empty output lines
             -t                                               equivalent to -vT
             -T, --show-tabs                     display TAB characters as ^I
             -u                                              (ignored)
             -v, --show-nonprinting     use ^ and M- notation, except for LFD and TAB
                  --help                                display this help and exit         
                  --version                          output version information and exit

examples  :
----------------

cat file1                                   : display a file
cat file1 file2 file3 > all     : combine files to form `all`
cat note5 >> notes            : append note5 to the notes file
cat note5 > notes              : overwrite notes with note5
cat > temp1                         : create a file, end with EOF
cat > temp2 << STOP       : create a file, end with STOP


find

Search for files in a directory hierarchy. You can search for files by name, owner, group, type, permissions, date, and other criteria.  The search is recursive in that it will search all subdirectories too.

usage          :    find [pathnames] [conditions]

examples  :
----------------

find $HOME -print                                                  : list files and subdirectories in your home directory.
find /project -name data -print                         : looks for data starting its scan in the /project directory
find /project -name 'model*' -user index     : looks for any files beginning with model,
                                                                                         owned by index
find / -size 0 -ok rm {} \;                                        : looks for, and removes all files that are
                                                                                         0 bytes, prompts you before removal


If you are looking a good eBook here is my recommendation for a starter:

Ubuntu®Linux®
TO O L B OX
1000+ Commands for Ubuntu
and Debian Power Users

by: Christopher Negus and François Caen

View/Download here: http://www.mediafire.com/view/3bptw3fmvbyb989/Wiley.Ubuntu.Linux.Toolbox.1000.plus.Commands.for.Ubuntu.and.Debian.Power.Users.Nov.2007.pdf

That's all, hope you like it :-)
Happy sunday! God bless you all

0 comments:

Post a Comment