LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Interesting linux commands (https://www.linuxquestions.org/questions/linux-newbie-8/interesting-linux-commands-840921/)

pinga123 10-28-2010 04:59 AM

Interesting linux commands
 
I m writing an article over interesting linux commands .
I would be glad if someone adds to the list.

1)Command to find the Installation date of O.S.
2)How to find Most Used Linux commands of your machine?

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

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

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

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

other way of doing the same thing.

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

==================================================

quanta 10-28-2010 05:05 AM

An interesting address for who don't know: http://www.commandlinefu.com


All times are GMT -5. The time now is 06:06 AM.