From Network Security Wiki


Task Command
Add a user sudo adduser USER_NAME
Delete a user sudo deluser USER_NAME
Change user password sudo passwd USER_NAME
Changes user fullname, office number, office extension,
and home phone number information
sudo chfn USER_NAME
Display user information finger USER_NAME
Temporarily prevent a user from logging in sudo usermod -L USER_NAME
Revoke the operation above sudo usermod -U USER_NAME
Add a user to admin group sudo usermod -G admin -a USER_NAME
Change hostname sudo hostname new_name


Task Command
Ping with Beep ping -i 2 -a
Ping a Subnet & display only hosts which are UP for i in {1..254}; do ping -c 1 -W 1 192.168.1.$i | grep from; done
Configure an ADSL connection sudo pppoeconf
Starts up ADSL connections sudo pon dsl-provider
Shuts down ADSL connections sudo poff
Display MAC of a given IP address arping IP_ADDRESS
Display NetBIOS name of a given IP address nmblookup -A IP_ADDRESS
Display IP address and MAC ifconfig -a
Display route netstat -rn
Change MAC of ethernet interface using ifconfig sudo ifconfig eth0 hw ether 00:11:22:33:44:55
Change MAC Address permanebtly sudo gedit /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
hwaddress ether 00:01:02:03:04:05
Display the network path to a given host tracepath example.com
Request an IP address from DHCP server sudo dhclient
Display the status of ethernet card sudo ethtool eth0
List processes which are using port 80 lsof -i :80
Port used by which process lsof -t -i tcp:443
Adding a default route with route route add default gw
View route table route -n
Adding a static route with route route add -net netmask gw
Adding DNS addresses vi /etc/resolv.conf
search isp.com
Edit Hosts file sudo gedit /etc/hosts
Display Details of All interfaces Including Disabled Interfaces ifconfig -a
Whats going on in the Network netstat -ant | awk '{print $6}' |sort | uniq -c | sort -n
To display the routing table netstat -rn
To display all the opened network sockets netstat -uta
DNS Traffic sudo tcpdump -pni eth0 'port domain'
Set the HTTP proxy export http_proxy=http://PROXY.DOMAIN.NAME:PORT
Samba findsmb
sudo smbtree
ifconfig ppp0
lspci | grep Network
sudo ifconfig wlan0 up
Setting IP Address using ifconfig ifconfig eth0 netmask broadcast
Full Duplex Network Card sudo ethtool eth0
sudo ethtool -s eth0 speed 1000 duplex full autoneg off
MII-Tool sudo ifdown eth0
mii-tool -F 100baseTx-FD eth0
sudo ifup eth0

GPRS Dial-up Internet Connection

sudo apt-get install bluez-utils
sudo apt-get install blues-pin
sudo apt-get install ppp
hcitool scan
sudo hcitool cc 00:22:98:E3:5F:35
sudo hcitool auth 00:22:98:E3:5F:35
sdptool browse 00:22:98:E3:5F:35

sudo gedit /etc/bluetooth/rfcomm.conf

rfcomm0 {
       bind yes;
       device 00:22:98:E3:5F:35;
       channel 2;
       comment "PPP connect";
$sudo /etc/init.d/bluez-utils restart

First create the file /etc/ppp/peers/bluetoothconn

connect "/usr/sbin/chat -v -f /etc/chatscripts/bluetoothconn"
/dev/rfcomm0 115200
lcp-echo-failure 0

Now edit the file /etc/chatscripts/bluetoothconn

 ''      rAT
 OK      'AT+CGDCONT=2,"IP","btmobile.bt.com"'
 OK      ATD*99***2#

found that ***2 worked. You might have to play around with this for your own telco - try swapping the '2' for any integer between '1' and '4', or even remove the whole lot and just terminate with a '#'.

To bring the connection up

$pon bluetoothconn

and to turn it off again:

$poff Bluetoothconn

Mount Network Drives in fstab

$mount -t cifs -o username=yourusername,password=yourpassword,domain=yourdomain //server/sharename/ /mnt/folderonyourcomp/
options     : username=yourusername,password=yourpassword,domain=yourdomain
type        : cifs 
file system : /mnt/folderonyourcomp (this is your local mountpoint for the remote share)

Update fstab:

#<file system>         <mount point>   <type>  <options>                     	              <dump>  <pass>
proc            	/proc           proc    nodev,noexec,nosuid 	                        0       0
UUID=467A89307A891DB5 	/VM 		ntfs 	defaults 		                        0 	2
UUID=467A89307A891DB5 	/VM 		ntfs 	defaults 		                        0 	2
/mnt/folderonyourcomp	/		cifs	username=aman,password=cisco,domain=yourdomain	0	2
NFS Mount

Source: digitalocean.com

        This section needs to be tested.
On Server side


sudo apt-get install nfs-kernel-server
  • Make a share directory called nfs:
sudo mkdir /var/nfs/general -p
  • NFS will translate any root operations on the client to the nobody:nogroup credentials as a security measure.
  • Therefore change the directory ownership to match those credentials:
sudo chown nobody:nogroup /var/nfs/general
  • For /home do not change permissions, else it will break down the system.
  • Configuring the NFS Exports
sudo nano /etc/exports
rw: This option gives the client computer both read and write access to the volume.
sync: This option forces NFS to write changes to disk before replying. This results in a more stable and consistent environment since the reply reflects the actual state of the remote volume. However, it also reduces the speed of file operations.
no_subtree_check: This option prevents subtree checking, which is a process where the host must check whether the file is actually still available in the exported tree for every request. This can cause many problems when a file is renamed while the client has it opened. In almost all cases, it is better to disable subtree checking.
no_root_squash: By default, NFS translates requests from a root user remotely into a non-privileged user on the server. This was intended as security feature to prevent a root account on the client from using the file system of the host as root. no_root_squash disables this behavior for certain shares.

Restart NFS

sudo systemctl restart nfs-kernel-server
On Client side
sudo apt-get install nfs-common
  • Edit fstab file:
sudo nano /etc/fstab /mnt/cores/ nfs auto,noatime,nolock,bg,nfsvers=3,intr,tcp
  • Test the mount:
sudo mount -a

Different ways to disable IPv6 for network efficiency

1. gksudo gedit /etc/modprobe.d/aliases


alias net-pf-10 ipv6


alias net-pf-10 off

If the above change is not working you need to change the following one

alias net-pf-10 off ipv6

Save the file and reboot

2. Disable IPv6 in Firefox. Type about:config and search for:

network.dns.disableIPv6 -> TRUE

3. gksudo gedit /etc/default/grub Change



GRUB_CMDLINE_LINUX_DEFAULT=”ipv6.disable=1 quiet splash”

Save and exit the file Update the grub from the command line

sudo update-grub

4. Another method:

echo "#disable ipv6" >> /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf

Backtrack-Ubuntu General Networking

/etc/init.d/networking start
sudo gedit /etc/network/interfaces file
  auto eth0
  iface eth0 inet static
sudo gedit /etc/resolv.conf
update-rc.d networking defaults

Webshare: Simple file server

#alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'

Run "webshare" and the current directory and everything beneath it will be served from a new web server listening on port 8000.

Network Manager issue after running pppoeconf

gksudo gedit /etc/network/interfaces

Remove everything but:

auto lo
iface lo inet loopback

gksudo gedit /etc/NetworkManager/nm-system-settings.conf


Restart computer or NetworkManager service


sudo trickled -d 40 -u 40

This will start the trickle daemon that will limit the total bandwidth available to all programs run via trickle to 20 K/s both up and down. So if you run a single program via trickle, it can consume 20 K/s. Two programs can each consume 10 K/s, etc.

sudo gedit /etc/trickled.conf

Priority = 1
Time-Smoothing = 0.1
Length-Smoothing = 1
Priority = 2 
Time-Smoothing = 5 
Length-Smoothing = 10 
Priority = 8


sudo aptitude install wondershaper
sudo wondershaper eth0 40 40

Download a big and uncompressable file while pinging to a fast and stable server on the internet or to your modem and adjust your downspeed until you are satisfied and do the same with uploading a big and uncompressable file.

When you are ready you can make these connection settings permanent by

sudo gedit /etc/network/interfaces

add these lines under eth1 if eth1 is your internetconnection. Change eth1,upspeed and downspeed to your settings.

up /sbin/wondershaper eth1 downspeed upspeed
down /sbin/wondershaper clear eth1

How do I go about putting my settings back to default for eth1?

sudo wondershaper clear eth1

XRDP on Ubuntu Server

Source: c-nergy.be

Additional Packages:

sudo apt-get install x11-xkb-utils
sudo apt-get install pkg-config

Installing Mate Desktop Environment:

sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon

Installing XRDP Paackage:

sudo apt-get install xrdp
sudo sed -i.bak '/fi/a #xrdp multiple users configuration \n mate-session \n' /etc/xrdp/startwm.sh
sudo systemctl restart xrdp

Samba for Windows Sharing


sudo apt-get install samba

Set a password for your user in Samba

sudo smbpasswd -a <user_name>

Backup current config file:

sudo cp /etc/samba/smb.conf ~

Edit smb.conf file:

sudo nano /etc/samba/smb.conf
[My Files]
Comment = USB Drive on Rpi
path = /media/usbdrive
#valid users = testuser
read only = no
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes

Restart the samba:

sudo service smbd restart

Check your smb.conf for any syntax errors


To access your network share

sudo apt-get install smbclient

List all shares:

smbclient -L //<HOST_IP_OR_NAME>/<folder_name> -U <user>


smbclient //<HOST_IP_OR_NAME>/<folder_name> -U <user>

Networking in 17.10 onwards

  • NetPlan replaces the static interfaces (/etc/network/interfaces) file.
  • Now you must use /etc/netplan/*.yaml to configure Ubuntu interfaces.
  • The new interfaces configuration file now live in the /etc/netplan directory.
  • A file called 01-netcfg.yaml is used to configured the first interface.
Below is the default configuration for a interface using DHCP
 version: 2
 renderer: networkd
     dhcp4: yes
     dhcp6: yes

To save your changes, you run the commands below.

sudo netplan apply
Configuring Static IP Addresses

To configure a static IP address using the new NetPlan tool, the file should look like this:

 version: 2
 renderer: networkd
     dhcp4: no
     dhcp6: no
     addresses: []
       addresses: [,]

Exit and save your changes by running the commands below

sudo netplan apply
Networking Service

Restarting Networking Service:

sudo systemctl restart networking
sudo systemctl restart networking.service

To verify status:

sudo systemctl status networking.service
IP Traffic Forwarding

Enable IPv4 Forwarding:

# sudo su
# echo "1" > /proc/sys/net/ipv4/ip_forward


# cat /proc/sys/net/ipv4/ip_forward

Make the change persistent:

# sysctl -a | grep ip_forward
net.ipv4.ip_forward = 1     ==> Copy this line
# vi /etc/sysctl.conf 
net.ipv4.ip_forward = 1     ==> Paste it at the end of this file

IPtables rules:

iptables -t nat -A POSTROUTING -o ens192 -j MASQUERADE
iptables -A FORWARD -i ens193 -o ens192 -j ACCEPT
iptables -A FORWARD -i ens193 -o ens192 -m state --state RELATED,ESTABLISHED -j ACCEPT

Software Centre

Task Command
To get a list of all the installed packages dpkg -l
Display the packages which are not installed but have remained residual config dpkg -l | awk '/^rc/ {print $2}'
Display a list files installed for a given package dpkg -L PACKAGE_NAME
Display a list of packages installed for a given file dpkg -S FILE_NAME
Display a list of packages whose name matches given regex pattern apt-cache search REG_EXPRESSION
Display a list of packages with given file apt-file search FILE_NAME
Display a list of packages which depends on a package apt-cache depends PACKAGE_NAME
Display a list of packages that depend on the given package apt-cache rdepends PACKAGE_NAME
Delete residual package configuration files dpkg -l | grep ^rc | awk '{print $2}' | sudo xargs dpkg -P
Automatically install necessary files for './configure ; make ; make install' sudo auto-apt run ./configure
Save list of packages installed on your system dpkg --get-selections | grep -v deinstall > SOME_FILE

Then use the file to restore packages:
dpkg --set-selections < SOME_FILE ; sudo dselect

Deb files are stored in "/var/cache/apt/archives", clean this directory sudo apt-get clean
Display URL for a given package apt-get -qq --print-uris install PACKAGE_NAME
Display some statistics about the apt cache apt-cache stats
Display all package name apt-cache pkgnames
Display some information of a given package apt-cache show PACKAGE_NAME
Backup Sources to a file cat /etc/apt/sources.list /etc/apt/sources.list.d/* > ~/sources.list

Restore from the file:
sudo mv ~/sources.list /etc/apt/
sudo apt-get update

Downloading GPG Keys after Repository addition sudo apt-get install launchpad-getkeys
sudo launchpad-getkeys


Task Command
Poweroff your computer sudo halt
sudo shutdown -h now
sudo init 0
Poweroff your computer in 23:00 sudo shutdown -h 23:00
Poweroff your computer after 60 minutes sudo shutdown -h +60
Force the filesystem check during reboot shutdown -Fr now
Reboot your computer sudo shutdown -r now
init 6
Terminate a process with a given process id sudo kill -9 PROCESS_ID
Terminate all processes with a given name sudo killall PROCESS_NAME
Temporarily restart an init script sudo /etc/init.d/SCRIPT_NAME restart
Temporarily stop an init script sudo /etc/init.d/SCRIPT_NAME stop


Task Command
Display Linux distributor's ID lsb_release -is
Display Linux release number lsb_release -rs
Display Linux code name lsb_release -cs
Display 32-bit or 64-bit uname -m
Display processor 32-bit or 64-bit lshw -class processor | grep width
List all PCI devices lspci
Display a list of modules in the Linux Kernel lsmod
List USB devices lsusb -v
List hardware sudo lshw
List harddisk partitions sudo fdisk -l
sudo fdisk -l -u /dev/sda
Display SATA harddisk parameters sudo hdparm -I /dev/sda
Display disk space usage df -h
Display file/folder space usage du -bsh FOLDER_NAME
Display amount of free and used memory free
See a total memory including swap free -t
Display processes ps -e
ps -ef
-e selects every process
-f chooses the full
Trying to find the PID ps -A | grep firefox-bin
pgrep -l firefox-bin
List Processes in a Hierarchy ps -ef --forest
ps -axjf
Display a tree of processes pstree
List files which are opened by a given process lsof -p PROCESS_ID; lsof -c PROCESS_NAME
List processes which opened a given file lsof FILE_NAME
Read a long file less FILE_NAME
Print lines matching a pattern grep REG_EXP FILE_NAME
Display a list of files,containing a given string grep -lr REG_EXP PATHNAME
Display all '.txt' file find . -name '*.txt'
Determine file type file FILE_NAME
Output the last 6 lines tail -n 6 FILE_NAME
Display subdirectories in current directory ls -d */.
Display file number in current directory ls . | wc -w
Displays a calendar cal
Display HTTP HEAD response w3m -dump_head http://example.com
Display file content with line number nl FILE_NAME
tail -n 15 /var/log/syslog
tail -f
df -h
which dumpcap
identify -verbose /home/bai.jpg
Continuously monitor the memory usage watch -d free
watch 'ls -l /home/02.avi'
Watch a folder for changes watch -d -n 5 ls -l
Filter history command for a keyword history | grep nessus
Check the status of all the services service --status-all
Get your IP address ifconfig | grep "inet addr:" | awk '{print $2}' | grep -v '' | cut -f2 -d:
Show all startup applications sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop

Modifies each autostart file and changes the “NoDisplay” parameter from
“true” to “false”, restart the Startup Applications dialog, more options will appear.

List all Users awk -F':' '{ print $1}' /etc/passwd
awk -F: '$0=$1 " uid="$3' /etc/passwd
cut -d: -f1 /etc/passwd (using : as the delimeter)


Task Command
Display timestamp using HISTTIMEFORMAT export HISTTIMEFORMAT='%F %T '
history | more
Search the history using Control+R Press Control+R and type the keyword
To edit a command from history before executing it Press Control+R and type the keyword, Press left or right arrow key to edit cmd
Repeat previous command quickly using 4 different methods Use the up arrow
Type !!
Type !-1
Press Control+P
Execute a command from history history | more
Execute previous command that starts with a specific word !hist
Control the total number of lines in the history using HISTSIZE vi ~/.bash_profile
Change the history file name using HISTFILE vi ~/.bash_profile
Eliminate the continuous repeated entry from history using HISTCONTROL export HISTCONTROL=ignoredups
Erase duplicates across the whole history using HISTCONTROL export HISTCONTROL=erasedups
Force history not to remember a particular command using HISTCONTROL export HISTCONTROL=ignorespace
A space before cmd will also ignore it from history
Clear all the previous history history -c
Disable the usage of history using HISTSIZE export HISTSIZE=0
Ignore specific commands from the history using HISTIGNORE export HISTIGNORE="pwd:ls:ls -ltr:"
Rerun previous command with few changes ^dev^gui
This will replace "dev" from previous cmd with "gui"


Task Command
Read page by page using 'more' after pipe dmesg | more
View Available System Memory dmesg | grep Memory
View Ethernet Link Status (UP/DOWN) dmesg | grep eth
Clear Messages in dmesg Buffer dmesg -c


Task Command
Message with icon & Title for 5000 milliseconds notify-send "Title" "Message Body" -i /usr/share/pixmaps/idle.xpm -t 5000
Show contents of a file notify-send test "`tail /var/log/syslog`"
Follow log file tail -n0 -f /var/log/messages | while read line; do notify-send "System Message" "$line"; done
Format message with HTML notify-send Test "<font size=16 color=blue><b><i>Hello World</b></i></font>"


beep -f 200 -d 1 -r 5 -n -f 300 -d 10 -r 4 -n -f  400 -d 10 -r 3
beep -f 784 -l 600
beep -f 784 -r 3 -l 100
beep -f 1000 -n -f 2000 -n -f 1500
 beep -f 659 -l 460 -n -f 784 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 880 -l 230 -n -f 659 -l 230 -n -f 587 -l 230 -n -f 659 -l 460 -n -f 988 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 1047-l 230 -n -f 988 -l 230 -n -f 784 -l 230 -n -f 659 -l 230 -n -f 988 -l 230 -n -f 1318 -l 230 -n -f 659 -l 110 -n -f 587 -l 230 -n -f 587 -l 110 -n -f 494 -l 230 -n -f 740 -l 230 -n -f 659 -l 460


  • Remove language related ign from apt-get update:
sudo nano /etc/apt/apt.conf.d/00aptitude

Add the following line at the end of this file:

Acquire::Languages "none";
  • Reduce overheating:

You don’t need to do anything after installing TLP. It works in the background.

sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw
sudo tlp start
  • Install CPUFREQ indicator, Restart your computer and use the Powersave mode in it:
sudo apt-get install indicator-cpufreq

If using Gnome, then goto https://extensions.gnome.org & install extensions.

  • Install preload to speed up application load time, restart your computer and forget about it. It will be working in the background:
sudo apt-get install preload
  • Manage startup applications

Open Startup Applications & select applications that can be delayed in startup.

Add sleep 10; in all application commands which you want to delay:

For example, for Dropbox:

dropbox start -i

Changes to

sleep 20; drobox start -i
  • This command lists services started at boot-time:
service --status-all
  • If you have systemd, use this command to find the services that run at boot time:
sudo systemctl list-unit-files --state=enabled
  • Check If Your Hard Drive Is Overworking
sudo apt install iotop
  • Use Bootchart to find out slow services/processes:
systemd-analyze time
systemd-analyze blame
systemd-analyze plot > bootchart.svg

At some point during the upgrade, the initramfs config was modified, adding a line pointing to a nonexistent swap partition. The slow boot was because it was looking for this partition and then timing out after 30 seconds.

sudo nano /etc/default/grub

Add noresume to the below line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noresume"
sudo update-grub
sudo reboot


Task Command
Reclaim memory which stores pagecache, dentries and inodes echo 3 > /proc/sys/vm/drop_caches
Modify the information displayed after logging in sudo vim /etc/motd.tail
Choose the input method for X Window im-switch -c
Convert the file name from GBK to UTF8 convmv -r -f gbk -t utf8 --notest FILE_NAME
Convert the file content from GBK to UTF8 iconv -f gbk -t utf8 FILE_NAME
Convert tags in '*.mp3' from GBK to UTF8 find . -name '*.mp3' -execdir mid3iconv -e GBK {} \;
Create two empty files touch file_name_1 file_name_2
Create directory. Create parent directories as needed mkdir -p /tmp/a/b/c/d/e
Copying hidden files only to a new destination cp .*
Copy directory.Preserve links,file mode,ownership,timestamps cp -a SOURCE_DIRECTORY DEST_DIRECTORY
Rename '*.rm' files to '*.rmvb' files rename 's/.rm$/.rmvb/' *
Change the file name to lowercase rename 'tr/A-Z/a-z/' *
Extract "*.gz" file gunzip FILE_NAME.gz
Extract "*.tar.gz" file tar zxf FILE_NAME.tar.gz
Extract "*.tar.bz2" file tar jxf FILE_NAME.tar.bz2
Do compression tar czf FILE_NAME.tar.gz FILE1 FILE2 FILE3
tar cjf FILE_NAME.tar.bz2 FILE1 FILE2 FILE3
Set the date and time via NTP sudo ntpdate ntp.ubuntu.com
If you want some program to start up automatically put '.desktop' files into '$HOME/.config/autostart'
You can configure "preferred applications" by this file "$HOME/.local/share/applications/mimeapps.list"
Eliminate Rootkit sudo rkhunter --checkall
Clear Bash history history -c
Record & play audio from MIC arecord -D plughw:0,0 -c 1 -r 8000 -f S16_LE - | aplay -D plughw:0,0 -c 1 -r 8000 -f S16_LE -
To restart X log off
press Ctrl-Alt-Backspace at the login screen
sudo gedit /etc/NetworkManager/nm-system-settings.conf
Disable the user list sudo -u gdm gconftool-2 --set --type boolean /apps/gdm/simple-greeter/disable_user_list true
Re-enable the user list sudo -u gdm gconftool-2 --set --type boolean /apps/gdm/simple-greeter/disable_user_list false
Schedule commands using 'at' at now +1 min
at teatime
at now +5 days
at 06/25/08
Access USB Serial Device setserial -g /dev/USBttyS0
etherape -r capture_file
Restart Unity unity --replace &
RedShift redshift -l geoclue -m vidmode -t 6300:4800
Remove Unity Dash History rm ~/.local/share/zeitgeist/activity.sqlite && zeitgeist-daemon --replace &
Make a dictionary file cat words.txt | sort | uniq > dictionary.txt
cat '/home/amnesia/Desktop/tails-0.6.2.iso' > /dev/sdc && sync
yes lfy > /home/aman/yes.txt
twistd -n web --path /home/aman
split --bytex=1024m --suffix-length=1 -d rhel.iso cd-
Run a file as a Daemon in background nohup youfile.sh &
Reset Unity launcher icons unity --reset-icons
To reset Compiz gconftool-2 --recursive-unset /apps/compiz-1 && unity --reset
To restart compiz compiz --display :0 --replace
Copy all images to external hard-drive ls *.jpg | xargs -n1 -i cp {} /data/tmp
Download all the URLs mentioned in the url-list.txt file cat url-list.txt | xargs wget -c
Generate a random password /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6
Reduce reserved space from 5% to 1% sudo tune2fs -m 1 /dev/sda5
To blacklist folders & applications from Dash History activity-log-manager
Lock screen CTRL + ALT + L
Remove duplicate lines using awk awk '!($0 in array) { array[$0]; print }' temp
Join Active Directory net ads join –U aman
Ubuntu Icons location /usr/share/icons/
Make Computer speak for you espeak "hello"
espeak -p 80 "hello"
espeak -s 80 "hello"
Zenity GUI Message box zenity --info --text "Saluton mondo"
This will create a list populated with the output of ls ls /var/log | zenity --list --column="Files and directories"
Ignore errors of a command command 2> /dev/null
To Clear your terminal's screen ctrl-l
List of commands you use most often history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
Runing the last command as Root sudo !!
To run last executed command that starts with echo !echo
Make a file read only for all users and even the root user chattr +i /home/aman/image.png
Rename a directory via the command line mv /home/user/oldname /home/user/newname
To delay startup applications during bootup ‘dropbox start -i‘ changes to ‘sleep 20; drobox start -i‘
Bulk rename files removing a specific string in names e.g.
foo_1.jpg ---> 1.jpg
foo_AAA.pdf ---> AAA.pdf
for i in foo_*; do mv $i ${i/foo_/}; done
Find out the time for which a server is Up uptime
Use do loop to repeat a command while true; do beep; sleep 300; done
Command to Eject CDROM eject /dev/sr0/
Erase files more securely shred
Remove root files sudo rm -rf /opt/lampp

Ubuntu Upgrade using ISO

sudo mount -o loop ~/Desktop/ubuntu-9.10-alternate-i386.iso /media/cdrom0
sudo mount -t iso9660 -o ro,loop=/dev/loop0 <ISO_File> <Mount_Point>
sudo apt-get update && sudo apt-get upgrade -y

Colorful ls

add these lines in $HOME/.bashrc:

if [ "$TERM" != "dumb" ]; then
   eval "`dircolors -b`"
   alias ls='ls --color=auto'


  • "Tasksel" group software packages into "task"s. You can select a "task" and then install all necessary software packages. It is easy to set up LAMP servers or cloud computing servers.

Show all tasks

tasksel --list

Display the extended description of a task

tasksel --task-desc lamp-server

List the packages which are parts of a task

tasksel --task-packages lamp-server

Install/remove a task

gksudo tasksel

Change Process priority

renice 5  `pgrep firefox`
renice -5 `pgrep wine-server`      
high <------------------> low
NEW_PRIORITY = -19, -18, -17 [...]18, 19, 20


Record a Voice File

 sox -t ossdsp /dev/dsp test.wav

Convert Raw Audio File to MP3 Music File

sox -w -c 2 -r 8000 audio1.raw audio1.wav
lame -h audio1.wav audio1.mp3
# : Denotes the super(root) user
$ : Denotes the normal user
Ctrl + Z: To stop a command that is working interactively without terminating it.
Ctrl + C: To stop a command that is not responding. (Cancellation).
Ctrl + D: To send the EOF( End of File) signal to a command normally when you see ‘>’.

Automount Partitions

sudo fdisk -l
sudo blkid
gedit /etc/fstab

 ==>> UUID=0be0771d-707c-4130-9add-4427fe321ebf  /data   ext4      defaults                                    0    2
 ==>> UUID=57561AE8337EA3CC	                 /winxp	 ntfs-3g   defaults,locale=en_IN,uid=1000,gid=1000     0    0

Enable Beep

sudo apt-get install beep
sudo gedit /etc/modules   ==>>   pcspkr

crontab -e

00 * * * * beep -f 2000 -l 500
sudo modprobe pcspkr 

and then beep should work.

If this works for you then to enable the loading of pcspkr permanently

gksudo gedit /etc/modprobe.d/blacklist.conf file 

comment out line that says blacklist pcspkr so it looks like this:

#blacklist pcspkr

Disable Hibernate

sudo gedit  /usr/share/polkit-1/actions/org.freedesktop.upower.policy

There are two sections, the first for suspend and the second for hibernate,Near end of each section will be a line with:


Change to this:


Save the changes and reboot

Enable Hibernate in Ubuntu 14.04

Test Hibernate:

   sudo pm-hibernate

Swap partition must be at least as large as your RAM. Check the memory and swap sizes on the Resources tab. “Memory” here refers to your RAM.

As user root, create a file /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla with the following content:

   [Re-enable hibernate by default in upower]
   [Re-enable hibernate by default in logind]

Then run the following command to restart the session (or simply reboot):

   $ killall indicator-session-service

Pidgin Gmail

protocol : XMPP
domain : gmail.com
Connect Server : talk.google.com

Pidgin with Google Talk

Download & Install the latest version of Pidgin.
Open Pidgin and go to Add / Edit Account window of Pidgin.
From the drop-down box choose XMPP as the Protocol.
For the Screen name enter your Google Id (Gmail Id). eg. manast86
For Server enter gmail.com
You can leave the Resource with the default Home
In the Password field enter your Google ID password.
Enter Local alias as whatever you want to.


Force old (port 5223) SSL: Checked
Allow plaintext auth over unencrypted streams: Un-Checked
Connect Port: 443
Connect Server: talk.google.com
Proxy type: Use Global Proxy Settings


The default value of swappiness in Ubuntu is 60, and it recommends swappiness=10 to improve overall performance. First, check the value of swappiness:

cat /proc/sys/vm/swappiness

Temporarily change swappiness value to 10 using following command, and it will be reverted in next restart.

sudo sysctl vm.swappiness=10

To permanently change this value:

gksudo gedit /etc/sysctl.conf

Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:


Finally, save the file and reboot.

Middle Click to Paste

Linux users can use two separate clipboards --the traditional clipboard with the Cut, Copy, and Paste operations and another clipboard – when you highlight some text with your mouse. On middle clicking in a text entry area, a copy of the text you highlighted gets pasted into the text entry field.

Wifi driver for BCM Chip

To test the driver (to prevent the need for a computer restart) use:

sudo modprobe -r b43 ssb wl brcmfmac brcmsmac bcma
sudo modprobe b43

If WiFi works after the above command:

sudo apt-get install firmware-b43-installer
sudo apt-get purge bcmwl-kernel-source

Ubuntu VNC Authentication issue

sudo apt-get -y install dconf-tools
dconf write /org/gnome/desktop/remote-access/require-encryption false
/usr/lib/vino/vino-server --sm-disable start

Making your own Bash wormholes

The mkfifo command makes a pipe for sharing data, connecting two running utilities with a kind of command line wormhole. The data that is sent into one end will instantly appear at the other end. The 'fifo' component of the command makes reference to the nature of the pipe - the data that's first comes in and out. You can create the pipe by typing mkfifo, followed by the name that you want to call it. Once you have created the pipe, you only need to route data into it. For eg

mkfifo fifo_pipe
tail -f fifo_pipe

Remote control MPlayer

Mplayer can be controlled from a console, a shell script or even over the network. It tells the program to accept commands from the stdin stream in place of keystrokes. You can combine this with the -input option, and commands are read from a file, or a FIFO. For example, in one terminal you can put:

mkfifo ~/mplayer-control
mplayer -slave -input file=/home/user/mplayercontrol

In another terminal-

echo "pause" >~/mplayer-control

The command will pause the currently running MPlayer and issue a command that will resume playback.

Sharing files in an easy manner

File sharing with Samba or NFS is easy once it is set up on both computers. What about file transfer to another computer on the network without the need for setting up software? If the file size is small it can be emailed. In the event of the computers being in the same room and USB devices being used on both, you can use a USB flash drive. The other option is Woof. This is a Python script that can run on any Linux (or similar) computer. You can download the script from the homepage at http://www.home.unix-ag.org/simon/woof.html and make it run. You can then share the file by using this command.

./woof /path/to/myfile

Most common user Commands

history | awk '{print $2}' | sort | uniq -c | sort -rn | head -10

Cleanup old Kernel files

dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get -y purge

Modified version to remove both images & headers:

echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -V | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo apt-get -y purge


Source: shellhacks.com

Install and run FIGlet

sudo apt-get install figlet
figlet "Shell Hacks"

Change Fonts

figlet -f digital "Shell Hacks"

If you would prefer centered output

figlet -c "Shell Hacks"

Print a list of available FIGlet fonts :


You can also download and use additional FIGlet fonts:

wget http://www.figlet.org/fonts/univers.flf
figlet -f univers.flf "lol"

To display the output of a command, pipe the cmd:

date +%r | figlet -f bubble

Copy-Paste the output of this file to below file(create it if it is not present):


You can alter the complete MOTD message from below files:


Mount VMDK file

Source: stackoverflow.com


sudo apt install libguestfs-tools

Check Disks & partitions

sudo lsblk

Create Mount point:

sudo mkdir /mnt/vmdk

Mount the VMDK Image:

sudo guestmount -a pro_nlb_avi-se-02old-disk1.vmdk -m /dev/sda3 --ro /mnt/vmdk
cd /mnt/vmdk

Unmount the image:

sudo guestunmount /mnt/vmdk

Thumbnails for Media

Install Thumbnail applications

sudo apt install ffmpegthumbnailer
sudo apt install gstreamer1.0-libav

Clear the cache

rm -r ~/.cache/thumbnails/fail


rm -rf ~/.cache/thumbnails/*

{{#widget:DISQUS |id=networkm |uniqid=Ubuntu |url=https://aman.awiki.org/wiki/Ubuntu }}