Q&A

When I try to setup the VirtualBox Guest Additions using the command sudo service vboxadd setup I’m getting the error message “The headers for the current running kernel were not found.” but the headers are already in the newest version. So what can I do?

sudo apt-get install --yes dkms build-essential linux-headers-$(uname -r)

Finally, if you want to reinstall VirtualBox Guest Additions run the command:

service vboxadd setup

How to replace space char (or any char) with underscore (or any char) from files?

find . -type f -iname "*.mp3" -exec rename "s/ /_/g" {} \;

How can I find out my graphics card model on ubuntu?

lspci | grep VGA | sed 's/^.*: //'

How can I set nano editor to display line and column numbers?

echo "set const" > ~/.nanorc

How can I list all users or groups of my system?

awk -F: '{ print $1 }' /etc/passwd | column
awk -F: '{ print $1 }' /etc/group | column

How can I find the UUID (Universally Unique Identifier) of media storage devices on my system?

sudo blkid

How can I change the label of a Linux partition (ext2/ext3/ext4)?
First issue the command blkid to find the device e.g. /dev/sda1 and then change the label with a command like this:

e2label /dev/sda1 "Ubuntu-13.10"

How can I define an ntfs partition/disk to automount at system start-up?
First issue these commands…

sudo mkdir -p /media/Storage
sudo cp /etc/{fstab,fstab.orig}
sudo nano -w /etc/fstab

…and then add a line to file /etc/fstab like this

UUID=1234567890ABCDEF /media/Storage ntfs-3g rw,auto,user,fmask=0111,dmask=0000,windows_names,locale=en_US.utf8 0 0

How can I disable Ubuntu from displaying crash reports?

sudo sed -i "s/enabled=1/enabled=0/g" /etc/default/apport

How can I find the ip address given the host’s name?

host google.com | awk '/^[[:alnum:]].+has address/ {print $4}' | head -1

How can I search for a file only in a specified file system?

find / -mount -name "inco*.ttf"

How can I search for a file greater than a specific size?

find . -name "*.jpg" -type f -size +800k -exec ls -lh {} \;

How can I enable the Quick filter search box in Synaptic package manager?
Install the package apt-xapian-index with the command

sudo apt-get install apt-xapian-index

How can I change the group and others permissions to 0 (none) for all the files and directories recursively in the current working directory but leaving the owner’s permissions unchanged?

find . -exec chmod go-rwx {} \;

How can I disable the guest account at the lightdm login screen?
Take a backup first…

sudo cp -b /etc/lightdm/{lightdm.conf,lightdm.conf.orig}

…and then type

[[ ! $(grep "allow-guest" /etc/lightdm/lightdm.conf) ]] && \
  echo "allow-guest=false" | sudo tee -a /etc/lightdm/lightdm.conf >/dev/null

…or preferably this

sudo /usr/lib/lightdm/lightdm-set-defaults --allow-guest false

Finaly restart the lightdm with:

sudo restart lightdm

How can I determine whether the Linux installation is 32 or 64 bit (int numbers)?

getconf LONG_BIT

How can I remove all files (dotted or not) in a directory?

rm -rf /path/to/directory/{*,.[^.].*}

Be aware of the fact that files with ... or more dots won’t be deleted and such files are usually viruses, rootkits etc!


How can I create a strong password?

apg -m 12 -x 14 -l -M SNCL

How can I list the status of all services in Ubuntu?

service --status-all
initctl list

How can I measure my network’s performance?
We’ll use the Iperf tool.
On the server side issue the command:

iperf -s

On the client side issue the command:

iperf -c <server's ip address> -f m

Get more info here and here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s