The Archives

  • 11.06.08
    man man cmd | pfortuny | (0)
    $ man man Some useful info not to be underestimated.
  • 10.31.08
    Adding line numbers to a file cmd | rafacas | (0)
    $ cat -b /etc/inittab 1 root:x:0:root 2 bin:x:1:root,bin,daemon 3 daemon:x:2:root,bin,daemon 4 sys:x:3:root,bin,adm 5 adm:x:4:root,adm,daemon 6 tty:x:5: 7 disk:x:6:root 8 lp:x:7:daemon,lp 9 mem:x:8: 10 kmem:x:9: 11 wheel:x:10:root 12 mail:x:12:mail 13 news:x:13:news 14 uucp:x:14:uucp ...
  • 10.29.08
    Opening a file with vi at specified position cmd | rafacas | (0)
    $ vi +10 /home/rafacas/test.txt Opens the file test.txt with the vi editor and positions the cursor on line 10.
  • 10.11.08
    screen… ttys as window managers (1) shell | pfortuny | (2)
    You either know it (in which case you probably will not bother to read on) or you must know it (and here I come to the rescue). Open your terminal of choice (in my OS X interface I press Command-0, which invokes quicksilver and then 'it <ret>', with which I get an iTerm instance). Then type $ screen and a help text appears, showing the usual GNU license text; press Return to continue. The screen blanks out as if you had just started your session. You are in, this is the red pill. You will never want out. Screen is a fully-featured 'terminal' window ...
  • 09.17.08
    Time cmd | pfortuny | (0)
    $ time for i in `ls` ; do cat $i ; done Shows the 'real', 'user' and 'sys' time invested in the task.
  • 09.03.08
    Taking screenshots cmd | n0str0m0 | (0)
    $ import -window root screenshot.jpg Takes a shot of the whole desktop and saves it in screenshot.jpg. import is part of the ImageMagick suite.
  • 08.28.08
    Listing files ordered by date cmd | rafacas | (0)
    $ ls -lt Lists files ordered by date starting at the newest one.
  • 08.19.08
    Copying preserving attributes cmd | rafacas | (0)
    $ cp -p /home/rafacas/file1 /tmp Copies preserving attributes (mode, ownership, timestamp) from the indicated files.
  • 08.15.08
    Looking at the End shell | n0str0m0 | (0)
    From time to time we want to see only a few lines near the end of a file. We often use cat or more, but this can be tedious when the file is big (like a very long log file). You can use these commands to read from the end of the file: tac. It works exactly as cat but reading from the end of the file tail. It reads from the end of the file. It has more features than tac. The one I found to be more interesting is the -f flag. It makes tail to continue reading from the ...
  • 07.17.08
    Roll the dice scripts | n0str0m0 | (5)
    Not a command, but a fun thing anyway. What if you need a dice (as I needed the other day while trying to play a game with my friends) and you don't have one? Bash can do it: $ while true;do let dice="$RANDOM % 6"; let dice=$dice+1;echo $dice;read;clear;done Though it's a long line, this is just an infinite loop in which we use the $RANDOM bash variable which generates a random number between 0 and 32767. After that, we divide it by 6 and take the remainder (so we have a number between 0 and 5) and add 1 to shift the interval ...