Linux top useful commands

()

Linux Top 20 useful commands from practice

You don’t want to see a complete list here, but there may be a start for some of the common Linux commands, useful for sysops and admins.

1. Translate ASCII character set to octal, decimal, and hexadecimal

$ man ascii
Linux Top 20 useful commands, man page ascii characters
Illustration: man ascii

2. Output calendar to console

$ cal
Linux Top 20 useful commands, Calendar view 6 months with week number, cal -n 6 -w

Calendar view 6 months with week number

$ cal -n 6 -w

3. Edit binary hexadecimal in VIM

$ vi file
 :%!xxd
 ..
 :%!xxd -r
 :wq

4. Compare two files

$ diff -w file1.txt file2.txt
2c2.3
< Jacqueline --> C. Meier
> Jacqueline Mayer

5. Find content in files recursively using find

$ find . -type f -print0 | xargs -0 grep "mojito"

6. Send a file as e-mail

$ mail -s subject jacque@unblog.ch < notes.txt

7. Download multiple URLs from list

$ cat download-urls.txt | xargs wget -c

8. Remove duplicate lines with awk

$ awk '!($0 in array) { array[$0]; print }' temp

Line output of /etc/passwd with the same uid and gid

$ awk -F ':' '$3==$4' /etc/passwd

9. Conversion from Windows/DOS (CR/LF) to Unix (LF) format

$ sed 's/.$//' filename
# Text Search and Replace
$ sed -e s/dog/cat/g file.txt > file.new
# Deletes all blank lines
$ sed '/^$/d' filename
# Deletes spaces at the end of each line
$ sed 's/ *$//' filename

10. Recursive String Search in Files

$ grep -r "ramsch" *

11. How many CPMs does my computer have?

$ grep processor /proc/cpuinfo | wc -l

12. View Free Memory

$ cat /proc/meminfo | grep MemFree
$ free -m

13. View active processes

$ ps -ef
$ ps aux
$ vmstat 5 10

14. Create directory tree (tree)

$ ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'

15. Output Asterisk PBX Applications

$ asterisk -rx "show applications" | awk '{print $1}' | sed -n -e "s/:"//p

16. Number of MTA emails identified by SPAM

$ cat /var/log/maillog | egrep -c '(Alert\!)|(identified spam)|(reject\:)'

17. How long does the computer run

$ uptime

18. Set time and date

$ date -s "Dec 12 18:30:00 2014"

19. Who am I and the effective user ID, UID and GID output

$ whoami
$ id

20. Output list of most recently logged in users

$ last -a

Conclusion

Linux Top 20 useful command examples from practice. You don’t want to see a complete list here, but there may be a start for some of the common Linux commands, useful for sysops and admins.

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

Your email address will not be published. Required fields are marked *