Linux List of Linux commands when you need it

A list of commonly used Linux commands. Great for new people like myself who are starting out :)
You should use this as a wallpaper.

B3rWX.png

peace.
 
There is one book from bpb publications that is a reference for linux commands. Do get that book if you want to learn a lot of commands.

Learning one new command a day is more useful these days than learning one new word a day :)
 
Here is something interesting and time saving which I do.

Run this

history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r

It gives a list of commands you've issued ordered by frequency. Now one can choose long commands and setup an alias, so that it can be done in fewer keystrokes.
 
Did some one notice

That screen saver or whatever you call it has very destructive command.

rm -rf / : make computer faster.

Its up to you if you want it to be a screen saver.

BTW Some interesting commands from my blog.

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:

# 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.

# find / -name install.log

/root/install.log

then you can check the detail using ls -ltr /root/install.log.

# ls -ltr /root/install.log

-rw-r--r-- 1 root root 14038 Oct 13 13:40 /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 .

# 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

other way of doing the same thing.

# 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:

#ethtool -p eth0 20

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

#dd if=/dev/urandom of=/dev/dsp

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.

# ssh username@Ipaddressofmachine dd if=/dev/urandom of=/dev/dsp

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.

# 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

As you can see from above output the process ID is 5556.

Step 2: Just kill it using.

# kill 5556

---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

# echo rm *.txt

above command will not delete all the txt files but will display what files will get deleted if you run

#rm *.txt

===================================================
 
pinga123 said:
Did some one notice

That screen saver or whatever you call it has very destructive command.

rm -rf / : make computer faster.

Lol...It looks like prank

5)Prevent accident Play safe use Echo.

Its always a good idea to foresee what would be the impact of your command.

for example

# echo rm *.txt

above command will not delete all the txt files but will display what files will get deleted if you run

#rm *.txt

Didn't knew this trick. Does it work with other commands apart from rm?
 
Gaurish said:
Lol...It looks like prank

Didn't knew this trick. Does it work with other commands apart from rm?

works but i guess the output may differ and sometime not desirable( depending your distribution).

# echo ls *.txt

ls abc.txt cba.txt

(Notice ls is not required but still printed)
 
Back
Top