The Archives
-
12.12.08awk specifying the field separator$ awk -F'=| ' '{print $3}' < code.pl Prints the third field in each line of regr_FF, using the regexp '=| ' as the field separator (FS). The example regexp means "either an equal sign or a space'.
-
12.10.08Statistics on a program’s running time$ time script.sh real 1m0.004s user 0m30.020s sys 0m20.030s Runs script.sh (it could be any program). When script.sh finishes, time command outputs a message on stdout giving timing statistics about this program's running time. These contain the elapsed real time between invocation and termination, the user's CPU time, and the system's CPU time.
-
12.06.08apropos$ apropos intro Lists man pages related to 'intro'.
-
12.04.08Extracting the filename from a path$ basename /path/to/this/file file
-
11.26.08Signals supported by processesYou know kill utility sends a signal to the processes specified by their pid. If you want to know all the signals implemented by your Operating System and supported by any process, type: $ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGEMT 8) SIGFPE 9) SIGKILL 10) SIGBUS 11) SIGSEGV ...
-
11.24.08Going to the previous directory$ cd - Go to the previously visited directory.
-
11.22.08man intro$ man intro Introductory stuff on Unix (or BSD/Linux...) commands.
-
11.17.08Output last lines of a file$ tail -20 test.txt Outputs the last 20 lines of file test.txt
-
11.10.08Find files ending in mp3$ find / -name "*.mp3" Search for (starting at the root / directory) all the files ending in ".mp3"
-
11.08.08Is this a tty?That is a funny question to ask if you are a human (because you *should* know the answer). But it is not that dumb for a system. As a matter of fact, among the multiple tests the shell admits (man 1 test), there is a -t which serves specifically for that: $ test -t 0 returns 0 (that is, success or true in shell jargon) if the standard input (file descriptor 0) is open and is associated with a terminal. So, unless things are going pretty bad, the following $ test -t 0 && echo $? Should always print a 0. However, when a file ...