Useful commands for Linux normal users and administrators
Recently, CLI is mostly used by Linux/Unix administrators since most popular linux distros come with a complete set of GUI applications that make the user use less and less the command line. In our previous post, we saw 11 useful commands for Linux/Unix administrators, in this post we will see a list of useful commands useful for both administrators and normal Linux users.
For Linux/Unix administrators:
1- Compare a remote dir with a local dir
$ diff -y <(ssh user@host find /boot|sort) <(find /boot|sort)
2- Trace and view network traffic
tcpdump -s 0 -w - port <port> | tcpdump -r - -A
3- Check if a machine is online
ping -c 1 -q MACHINE_IP_OR_NAME >/dev/null 2>&1 && echo ONLINE || echo OFFLINE
c 1 limits to 1 pinging attempt
q makes the command quiet (or silent mode)
/dev/null 2>&1 is to remove the display
&& echo ONLINE is executed if previous command is successful (return value 0)
|| echo OFFLINE is executed otherwise (return value of 1 if unreachable or 2 if you’re offline yourself).
I personally use this command as an alias with a predefined machine name but there are at least 2 improvements that may be done.
Asking for the machine name or IP
Escaping the output so that it displays ONLINE in green and OFFLINE in red (for instance).
4- Reverse SSH
ssh -f -N -R 8888:localhost:22 email@example.com
this command from the source server and this follow in the destination server:
ssh user@localhost -p 8888
5- Show mounted volumes in a table (Thanks to Shawn):
mount | column -t
6- The fastest way to kill tcp or udp port is to run the following command (Thanks to Sriram):
fuser -k PORT-NUMBER-HERE/tcp fuser -k PORT-NUMBER-HERE/udp
7- edit a file on a remote server using vim from your Linux / Unix / OS X desktop:
Commands for Both Normal users and Linux admins
8- Grep your command history (Thanks to Shawn)
history | grep /pattern/
9- Extract audio from Flash video (*.flv) as mp3 file
ffmpeg -i video.flv -vn -ar 44100 -ac 2 -ab 192k -f mp3 audio.mp3
10- copy hybrid iso images to USB key for booting from it, progress bar and remaining time are displayed while copying
time (pv file.iso | dd bs=1M oflag=sync of=/dev/sdX 2>/dev/null)
11- what model of computer I’m using?
sudo dmidecode | grep Product
Like us on Facebook
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- How To Install Netflix In Ubuntu : Hi unixmen readers! How are you? In this article we will teach you how to install the desktop vers...2 comments |
- How To Show Username On Panel In Ubuntu 13.04/13.10 : By default usernames are not displayed on panel in Ubuntu 13.04 and 13.10, In this simple tutorial w...0 comments |
- cowsay And fortune Combined Together : Hi linux geeks! In this article I will teach you a nice trick you can perform in the terminal with ...0 comments |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- Install lamp with 1 command in Ubuntu 12.10, 13.04 Raring Ringtail & LinuxMint13 : Updated: 10/09/2012 :LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform ...0 comments |
- How To Install Netflix In Ubuntu
- cowsay And fortune Combined Together
- How To Show Username On Panel In Ubuntu 13.04/13.10
- Setup DNS Server On openSUSE 13.1
- TeamViewer 9 Final Has Been Released!
- Twelve Vulnerabilities Have Been Fixed In Ubuntu 12.04, Time To Update
- OpenLDAP Installation and Configuration in Ubuntu 12.10/13.04/13.10 And Debian 6/7
- Configure Your Browser To Use Tor On Ubuntu/Debian/Linux Mint
- Setup A Full Featured ITIL Management System Using Integria IMS On CentOS 6
- Install LibreOffice 4.1.3 in Elementary OS ‘Luna’
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .