| Saturday, January 29th, 2005 |
2:46 pm [ilugcadmin] |
Bharathi's 'One Day One Command'
sort - Sort lines of text files Summary : Sort the file contents based on options given to it. By default the output is showed in the console. Examples : $ sort -- Take the input from stdin, sort and output in stdout. $ sort myfile -o myoutput -- Sort the myfile content and store in "myoutput" $ sort -b myfile -- Ignore the leading blanks and sort. $ sort -br myfile -- Same as above but in reverse order $ sort -c myfile -- Only Check whether myfile is already sorted $ sort -f myfile -- Ignore the case and sort (a == A) $ sort -u myfile -- Sort and output only unique lines $ sort -t : -k 2,2n -k 5.3,5.4 myfile -- Sort numerically on the 2nd field and resolve ties by sorting alphabetically on the 3rd and 4th characters of field 5. Use `:' as the field delimiter Read : man sort |
| Friday, January 28th, 2005 |
2:42 pm [ilugcadmin] |
Bharathi's 'One Day One Command'
ulimit - Control the resources available to processes Summary : ulimit, Bash Built-in Command, provides control over the resources (Virtual Mem, Max no .of process, Core file size, ...) available to processes started by the shell. If Max no. of user process is set to 5, then the particular user can't run more then 5 process. Examples : $ ulimit -a -- Show All current limits. $ ulimit -c -- Show core file size (If Core file size is 0, Core file will not be created during the SEG fault). $ ulimit -c 1000 -- Set new core file size. $ ulimit -u 3 -- Set max no .of user processes $ ulimit -n -- Show max open files. Read : info bash (or) help ulimit |
| Thursday, January 27th, 2005 |
7:03 pm [ilugcadmin] |
Bharathi's 'One Day One Command'
nl - Number lines of files Summary : Write each FILE to stdout, with line numbers added. With No FILE or -, read stdin Examples : nl myfile -- Writes all non-empty lines with number. nl -ba myfile -- Number all lines. nl -ba -l2 myfile -- Count 2 empty line as 1 and display nl -nln myfile -- Numbers are left justified. nl -nrz myfile -- Numbers are right justified and leading zeros nl -w2 myfile -- Uses 2 column for the line number. nl -s"> " myfile -- Insert "> " in between number and line. ls | nl -- ls Output with line numbers Read : man nl |
| Tuesday, January 25th, 2005 |
6:59 pm [ilugcadmin] |
Bharathi's 'One Day One Command'
touch - Change File Timestamps Summary : Update the access and modification times of each FILE to the current time. Examples : $ touch myfile -- change the time stamp to current time. If myfile is not there then touch will create it. $ touch -c myfile -- Same as above. But If myfile is not there, then it won't create it. $ touch -r f1 f2 -- Set f1's time to f2 instead of current time $ touch -a myfile -- Change only access time. $ touch -m myfile -- change only the modification time $ touch -t 200412251122.33 -- set this time instead of current time $ ls -lu myfile -- Shows the last access time Read : man touch |
| Monday, January 24th, 2005 |
6:57 pm [ilugcadmin] |
Bharathi's 'One Day One Command'
comm - Compare 2 Sorted files line by line Summary : Compare two sorted files F1 and F2 line by line. Examples : $ comm F1 F2 -- Output contain 3 col. Col 1 - Uniq to F1, Col 2 - Uniq to F2 and Col 3 - Comman to F1 & F2 $ comm -1 F1 F2 -- Suppress lines unique to F1 $ comm -2 F1 F2 -- Suppress lines unique to F2 $ comm -3 F1 F2 -- Suppress comman lines to F1 & F2 $ comm -13 F1 F2 -- Show lines from F2, which is not in F1 $ comm -23 F1 F2 -- Show lines from F1, which is not in F2 Read : man comm |
| Friday, January 21st, 2005 |
6:54 pm [ilugcadmin] |
Bharathi's 'One Day One Command'
ls -- List directory contents Summary : List the current directory contents and informations. Examples : $ ls -- Alphabetically list all files and dir $ ls -r -- Reverse order $ ls --color=always -- Output in color $ ls -F -- Files are classified with /@|= symbols $ ls -1 -- Output in single column $ ls -a -- Display hidden entries starting with . $ ls -R -- Recursive output $ ls -Q -- Enclose entry names in double quotes Read : man ls |
9:59 am [ilugcadmin] |
Bharathi's 'One Day One Command'
uname - Display system informations Summary:- Display system infos like OS Type, Kernel version, Arch, Host name etc... Main this uname will collect the info from the /proc/sys/kernel/{ostype, hostname, osrelease, version, domainname}. Examples :- $ uname -- Kernel Name $ uname -n -- Show the machine name $ uname -rv -- Show kernel's release & Ver info $ uname -om -- Show Arch and OS Type $ uname -a -- Show all info Read: man uname |
| Wednesday, January 19th, 2005 |
10:00 pm [ilugcadmin] |
Bharathi's 'One Day One Command'
df -- Disk Free and Usage report Summary:- df command display the amount of disk space available on the FileSystem (FS) containing each file name argument. If no file name is given, the space available on all currently mounted FSs is shown. Examples :- $ df -- Usage report of all mounted FS. $ df myfile -- Display usage report of FS which contain the myfile. $ df /home -- Usage report of Home partition $ df /dev/hda1 -- Usage report of /dev/hda1 $ df -Th -- Display the partition type and size is in human readable format $ df -x tmpfs -- Don't list the 'tmpfs' partitions. $ df -P -- Output in POSIX format. (Remove -P and see the difference) Read: man df |
10:18 am [ilugcadmin] |
free -- Display Information about Memory utilization Summary:- Displays the total amount of free and used physical memory & swap space in the system, as well as the buffers & cache consumed by the kernel. Examples :- $ free -- Display the mem info in KB. $ free -m -- Display the mem info in MB. $ free -m -t -- Display the total mem info. $ free -s 2 -- Display the mem info for every 2Sec. $ free -s 2 -c 5 -- Display the mem info for every 2Sec But only 5 times $ cat /proc/meminfo -- This is the original info which is used by free command for the report. Read: man free |
10:15 am [ilugcadmin] |
Bharathi's One Day One Command
watch - Periodically run and show the output of a program Summary: Watch runs command repeatedly, displaying its output This allows you to monitor the program output change over time. Examples :- $ watch ls -- Every 2sec(default time) 'ls' is executed and output is showed on the screen. $ watch -n 6 who -- Every 6Sec 'who' run and list the current users $ watch -d date -- Highlight the difference b/w successive updates Press Ctrl+C to stop the Watch Command. Read: man watch |
10:12 am [ilugcadmin] |
Bharathi's 'One Day One Command'
cat -- CATenate files & print on the STDOUT Summary: From Jargon File: Catenate is an obscure word meaning "to connect in a series", which is what the "cat" command does to one or more files. Cat will conCATenate the FILE(s) / STDIN to STDOUT. Examples: $ cat MyFile -- Dump the file to STDOUT $ cat File1 File2 File3 -- Dump File1, File2 & File3 $ cat -b File -- Print the File with Number for Non blank lines $ cat -s File -- Squeeze multiple blank lines to single. $ cat -A File -- Show the Non-Printable Chars also $ cat > File -- Concat the STDIN to STDOUT & FILE. Read: info cat |
10:09 am [ilugcadmin] |
Bharathi's One Day One Command
grep -- (Global Regular Expression Print) Print lines matching a pattern Summary: `grep' searches the input files for lines containing a match to a given pattern list. Grep has a no .of useful options and support regular expressions. Examples: $ grep -i bharathi Midas.txt -- Print the lines which contains string "bharathi" in the Midas.txt file $ grep -v bharathi ILUGC.txt -- Print the line which is not the string "bharathi" $ grep "^A" file -- Prints the line starting with A. $ grep "Z$" file -- Prints the line with ending letter Z. $ grep -c "Linux" file -- Prints count of match. $ grep '^[012]' file -- Prints the line starting with 0/1/2 Read : info grep / egrep / fgrep |
10:08 am [ilugcadmin] |
Bharathi's One Day One Command
alias - Create alias name for a command. Summary: alias is Bash build-in command. This is very useful to create a simple alias for a complex/long/frequent commands. Once alias created, you can use alias to call the original command. This alias are deleted after closing the shell session. For the next session, you have create it again. So avoid this problem, you add it in your .bashrc file. Example: alias -- Prints all alias commands alias ls="ls -F --color=always" alias cls=clear alias ls -- Print the alias' original command Read: man bash |
| Thursday, January 13th, 2005 |
10:13 am [ilugcadmin] |
Bharathi's 'One Day One Command'
echo - Display a line of text on the screen Summary: Echo is used to show a line of text on the screen with limited Esc sequence (BELL, Backspace, H-Tab, V-Tab,...) handling capabilities. Example: $ echo -- print a empty line $ echo "Bharathi\nMidas" -- Just print the Line $ echo -e "Bharathi\n\tMidas" -- Interpret and print the Line $ cat nums 1 2 3 $ echo -n `cat nums` -- Print the file content with-out new line char. 1 2 3 Read: man echo Bye :) -- Bharathi S |
10:11 am [ilugcadmin] |
Bharathi's 'One Day One Command'
date - Print & set the system data & time Summary: date will print the time information in different formats and we can also make a custom formats using the options. Example: $ date == print the current date and time $ date -d '3year ago' == Same date but 3 yr ago $ date --set='-10 minutes' == Reduce 10 min in the current time $ date '+%b %_e %a %X %Z %Y' == Current date in custom format. Read : info date Bye :) -- Bharathi S |
10:09 am [ilugcadmin] |
Bharathi's 'One Day One Command'
ac - Print statistics about users' connect time Summary: "ac" command will print the users' connect time details in different formats (Total, Per day, Per user, etc..) Example: $ ac -- print total useage. $ ac -p -- print indv user info $ ac -dy -- print daily based report. Read: man ac Bye :) -- Bharathi S |
10:07 am [ilugcadmin] |
Bharathi's 'One Day One Command'
info - Read documentation in Info format. Summary: Apart from Man pages, some commands comes with a detail manual pages, called info pages, which is in info format. This info command provides Menu, Search, Corss-Ref and many other facilities. Examples: $ info -- List all info pages available in the system. $ pinfo -- Curses based lynx-style info browser. $ info emacs -- Show Emacs info page. (See man emacs, to feel the difference) Read: info info, info pinfo Bye :) -- Bharathi S |
10:06 am [ilugcadmin] |
Bharathi's 'One Day One Command'
apropos - search the whatis database for strings Summary: This command will search the given string the Whatis DB and list the matchs on the screen. For example, the following command will list the available (in the whatis DB) compilers: apropos compiler Read: man apropos, whatis Bye :) -- Bharathi S |
10:04 am [ilugcadmin] |
Bharathi's 'One Day One Command'
man - Format and display the 'man'ual pages. Summary : Most of the Linux commands are comes with a specially formatted manuals, which explains "how to use the command and list options etc..". 'man' is used to view the manual page. This command has no .of useful options like -f, -k, -K, ... Read : man man Bye :) -- Bharathi S |