March 19, 2011

How little you know, and some useful commands

All contents below come from here.
----------------

Every week, I still find new commands, new methods, and alternate ways to accomplish things. Below are a few items I found this week that you may also find helpful.

Connect directly to your serial console, and log the session.
# screen -L /dev/ttyS0 9600


Print a line-number for each line in a text file
$ cat -n file

Use ‘mtr’ when debugging network issues:
$ mtr www.google.com

Re-run a command changing a parameter quickly:
$ ls -l 500.*
-rw-r--r-- 1 nwilkens nwilkens 0 2011-03-13 11:32 500.lst
-rw-r--r-- 1 nwilkens nwilkens 0 2011-03-13 11:32 500.txt
$ ^500^600
ls -l 600.*
-rw-r--r-- 1 nwilkens nwilkens 0 2011-03-13 11:32 600.lst
-rw-r--r-- 1 nwilkens nwilkens 0 2011-03-13 11:32 600.txt

Return your current IP address:
$ curl ifconfig.me
n.n.n.n

Typing a long command on the command line? Convert it to your favorite editor using:
cntrl-x cntrl-e

Update the default editor on Ubuntu.
$ sudo update-alternatives --config editor
There are 6 choices for the alternative editor (providing /usr/bin/editor).

Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/ng 80 auto mode
1 /bin/ed -100 manual mode
2 /bin/nano 40 manual mode
3 /usr/bin/emacs23 0 manual mode
4 /usr/bin/ng 80 manual mode
* 5 /usr/bin/vim.basic 30 manual mode
6 /usr/bin/vim.tiny 10 manual mode
Press enter to keep the current choice[*], or type selection number:

No comments:

Post a Comment

Days of our lives

Daisypath Anniversary tickers