Many of you might have noticed that I haven’t posted for a few days and also the post count has been decreasing over many days. This is all because I have been preparing for my exams (I am doing my engineering in Computer Science). I have not got enough time to post the ODOC (One Day One Command) series too. Anyway I would try to post if time permits.
sort – Sort lines of text files
Sort the file contents based on options given to it. By default the output is shown in the console.
$ 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
Free Software magazine staff launched FSDaily.com which gives daily news about free softwares. They introduced their blog at their website, but weren’t happy with it. So they have launched a seperate site Free Software Daily which is a lot like a news blog written by the authors of Free Software Magazine.
ulimit – Control the resources available to processes
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.
$ 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
Arudius (formerly Securinix) is a live CD Linux distribution based on Slackware (Minislack) and Linux Live scripts. It contains an extensive set of software tools used by IT security professionals for penetration testing and vulnerability analysis. Its goal is to include the most comlete set of useful security tools and still maintain a small footprint.
nl – Number lines of files
Write each FILE to stdout, with line numbers added.
With No FILE or -, read stdin
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
touch – Change File Timestamps
Update the access and modification times of each FILE to the current time. Also used to create a file.
$ 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
comm – Compare 2 Sorted files line by line
Compare two sorted files F1 and F2 line by line.
$ 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
ls — List directory contents
List the current directory contents and informations. This is one important command you would be using all the time. It is synonymous with the dir command in DOS.
$ 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