Interesting Linux Commands.
Posted 11-08-2010 at 10:47 PM by pinga123
Index:
1)Command to find the Installation date of O.S.
2)How to find Most Used Linux commands of your machine?
3)Blink LED of Network Card to find physical port
4)Command to scare people.
5)Prevent accident Play safe use Echo.
===================================================
1)Command to find the Installation date of O.S.
Still dont remember last time you have installed an OS.
Dont worry Following command can help you get the exact date.
Method 1:
Method 2:
First find the location of install.log in your machine.
then you can check the detail using ls -ltr /root/install.log.
in above example install.log is created on Oct 13 So the OS is installed on 13th Oct.
===================================================
2)How to find Most Used Linux commands of your machine?
I know the question is quite simple but yet interesting.You can use following command to find out which is the most used command of your Linux Machine .
other way of doing the same thing.
from above output its very clear that "cd" is the most used command in my distribution.
I know there are no practical usage of this command but sometime its good to know which command stress your fingers
===================================================
3) Blink LED of Network Card to find physical port corresponds network interfaces(eth0,eth1,...)... (Use this in-case of multiple network ports).
If you want to make sure which physical interface is eth0 and which is eth1 or eth2 and so on
run:
This blinks the LED on the interface for five seconds–without interrupting network traffic.
More commands will be updated soon.
===================================================
4)Command to scare people.
Well this one is one of my favorite.
It just produces random sound from your machine.
I use this command for following usage.
1)To scare people.
2)To find the machine location especially when you dont know the physical location.
how it works ?
Just type
The random sound will start coming up from your machine.
Well this may not be the fun but imagine if you can scare your colleague who sits in same LAN of yours.
Just use SSH to do this.
It will then ask you the password just type it and you are done.
To stop the noise you can find the process using following steps.
Step 1: Find process id of dd command.
As you can see from above output the process ID is 5556.
Step 2: Just kill it using.
---Process id can be different please run step 1 to check whats your process id and substitute in front of kill.
5)Prevent accident Play safe use Echo.
Its always a good idea to foresee what would be the impact of your command.
for example
above command will not delete all the txt files but will display what files will get deleted if you run
===================================================
1)Command to find the Installation date of O.S.
2)How to find Most Used Linux commands of your machine?
3)Blink LED of Network Card to find physical port
4)Command to scare people.
5)Prevent accident Play safe use Echo.
===================================================
1)Command to find the Installation date of O.S.
Still dont remember last time you have installed an OS.
Dont worry Following command can help you get the exact date.
Method 1:
Code:
# tune2fs -l /dev/root | grep created Filesystem created: Wed Oct 13 19:08:13 2010
Method 2:
First find the location of install.log in your machine.
Code:
# find / -name install.log /root/install.log
Code:
# ls -ltr /root/install.log -rw-r--r-- 1 root root 14038 Oct 13 13:40 /root/install.log
===================================================
2)How to find Most Used Linux commands of your machine?
I know the question is quite simple but yet interesting.You can use following command to find out which is the most used command of your Linux Machine .
Code:
# cut -f1 -d" " .bash_history | sort | uniq -c | sort -nr | head -n 10 113 cd 98 ls 83 xm 64 cat 59 dir 59 df 55 find 48 sysctl 42 vi 36 mount
Code:
# history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr 113 cd 98 ls 80 xm 64 cat 59 dir 59 df 55 find 48 sysctl 42 vi 36 mount
from above output its very clear that "cd" is the most used command in my distribution.
I know there are no practical usage of this command but sometime its good to know which command stress your fingers
===================================================
3) Blink LED of Network Card to find physical port corresponds network interfaces(eth0,eth1,...)... (Use this in-case of multiple network ports).
If you want to make sure which physical interface is eth0 and which is eth1 or eth2 and so on
run:
Code:
#ethtool -p eth0 20
More commands will be updated soon.
===================================================
4)Command to scare people.
Well this one is one of my favorite.
It just produces random sound from your machine.
I use this command for following usage.
1)To scare people.
2)To find the machine location especially when you dont know the physical location.
how it works ?
Just type
Code:
#dd if=/dev/urandom of=/dev/dsp
Well this may not be the fun but imagine if you can scare your colleague who sits in same LAN of yours.
Just use SSH to do this.
Code:
# ssh username@Ipaddressofmachine dd if=/dev/urandom of=/dev/dsp
To stop the noise you can find the process using following steps.
Step 1: Find process id of dd command.
Code:
# ps -ef |grep dd root 4861 1 0 11:35 ? 00:00:00 /usr/bin/hidd --server 68 5318 5311 0 11:36 ? 00:00:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket 68 5323 5311 0 11:36 ? 00:00:00 hald-addon-keyboard: listening on /dev/input/event0 root 5556 1 0 11:58 ? 00:00:00 dd if /dev/urandom of /dev/dsp root 5597 5571 0 11:59 pts/0 00:00:00 grep dd
Step 2: Just kill it using.
Code:
# kill 5556
5)Prevent accident Play safe use Echo.
Its always a good idea to foresee what would be the impact of your command.
for example
Code:
# echo rm *.txt
Code:
#rm *.txt
===================================================
Total Comments 6
Comments
-
seems that nt all cards support identification via blinking, it outputs the following:
Code:Cannot identify NIC: Operation not supported
Posted 11-08-2010 at 11:01 PM by Web31337
Updated 11-09-2010 at 01:34 AM by pinga123 -
You are right. Some older cards don't work with ethtool.BTW which card you are using.
also can you provide the output of ifconfig -aPosted 11-09-2010 at 01:32 AM by pinga123 -
The thing is the card is quite new, based on r8169, d-link. And one builtin.
Code:00:0a.0 Bridge: nVidia Corporation CK804 Ethernet Controller (rev a3) 05:06.0 Ethernet controller: D-Link System Inc DGE-528T Gigabit Ethernet Adapter (rev 10)
Posted 11-09-2010 at 01:40 AM by Web31337 -
Can you provide me the output of following?
Quote:ethtool eth0Quote:ethtool eth1Posted 11-09-2010 at 03:07 AM by pinga123 -
Code:
# ethtool eth0 Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000033 (51) Link detected: yes # ethtool eth1 Settings for eth1: Supported ports: [ MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: MII PHYAD: 1 Transceiver: external Auto-negotiation: on Supports Wake-on: g Wake-on: d Link detected: yes
Posted 11-09-2010 at 03:26 AM by Web31337 -
Its bit strange.Logically it should work but there is always a word called 'Exception'
Posted 11-09-2010 at 10:48 PM by pinga123