Some useful Linux tips and troubleshooting commands
- Some useful Linux tips and troubleshooting commands
- How to install the restricted codecs in Ubuntu
- How to boot an Ubuntu live ISO from the GRUB bootloader
- How to re-install the GRUB bootloader using a live Linux CD
- How to find out the domain name that goes with an IP address
- How to check if a host is up without using ping
- List all hard drives and partitions on your computer
- Run a command on the Linux shell that will be immune to hangups if you are disconnected
If you are getting this error when you are attempting to run Ubuntu on your PC; it is due to the fact that your CPU does not support the 64bit operating system that you are trying to run. You would need to use an i386 copy instead. This is due to the obvious limitations of a 32-bit CPU.
How to install the restricted codecs in Ubuntu
To install the required codecs for multimedia playback on Ubuntu; just type this command.
sudo apt-get install ubuntu-restricted-extras |
This will install everything that you need to get Ubuntu multimedia playback working.
How to boot an Ubuntu live ISO from the GRUB bootloader
If you wish to copy an Ubuntu live ISO to your hard drive and boot it without using a USB stick or a CDROM, then this posting will help you out.
http://www.securitronlinux.com/bejiitaswrath/how-to-boot-an-ubuntu-iso-without-a-thumb-drive-or-a-cd-read-more-to-find-out/. How to boot an Ubuntu ISO from the GRUB bootloader directly. This really works!
How to re-install the GRUB bootloader using a live Linux CD
http://www.securitronlinux.com/linux-mint-2/re-installing-the-grub2-bootloader-using-a-chroot-with-linux-mint-14/. Using a chroot to re-install the GRUB bootloader.
using aliases on the bash shell to make using the command line faster.
How to find out the domain name that goes with an IP address
Use the nslookup command to find the hostname that is associated with an IP address. This is a very useful command.
homer@neo:~$ nslookup 8.8.8.8 Server: 153.107.14.93 Address: 153.107.14.93#53 Non-authoritative answer: 8.8.8.8.in-addr.arpa name = google-public-dns-a.google.com. Authoritative answers can be found from: |
How to check if a host is up without using ping
If you are behind a proxy that blocks ping packets and you wish to check if a host is up; then this perl script will fulfil this task just fine.
Here is the output.
root@neo:/home/homer/Documents# ./net.pl Please type a host to check: -: 8.8.8.8 #-Protocol tcp 8.8.8.8 is NOT reachable. #-Protocol udp 8.8.8.8 is NOT reachable. #-Protocol icmp 8.8.8.8 is NOT reachable. #-Protocol stream 8.8.8.8 is NOT reachable. #-Protocol syn 8.8.8.8 is reachable. |
And here is a copy of the script.
#!/usr/bin/perl use warnings; use strict; use Net::Ping; # code source: http://www.perlmonks.org/?node_id=943892 # More: http://stackoverflow.com/questions/3960595/how-can-i-ping-a-host-with-a-perl-one-liner-with-netping #$| = 1; print "Please type a host to check: -:\n"; my $host = <>; #Reading input from STDIN. if (length($host) < 3) { print "You did not type a host!\n"; exit(0); } my @proto = ("tcp", "udp", "icmp", "stream", "syn"); foreach my $pro ( @proto ) { print "#-Protocol $pro \n"; my $p = Net::Ping->new($pro); chomp($host); # Specify source interface of pings print "$host is "; print "NOT " unless $p->ping($host, 2); print "reachable.\n"; $p->close(); } exit(0); |
Use this and at least one of the protocols will work. You need to run this as root to use ICMP probes though.
List all hard drives and partitions on your computer
Use the fdisk -l command as root to list all drives and partitions on your computer. This is useful if you want to install another Linux distribution and you wish to determine which partition you can use.
homer@neo:~/Documents$ sudo fdisk -l Disk /dev/sda: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0008186c Device Boot Start End Blocks Id System /dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT /dev/sda2 206848 234438655 117115904 7 HPFS/NTFS/exFAT Disk /dev/sdb: 320.1 GB, 320072932352 bytes 255 heads, 63 sectors/track, 38913 cylinders, total 625142446 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x2774878b Device Boot Start End Blocks Id System /dev/sdb1 2048 29362175 14680064 27 Hidden NTFS WinRE /dev/sdb2 * 29362176 29566975 102400 7 HPFS/NTFS/exFAT /dev/sdb3 29566976 418666495 194549760 7 HPFS/NTFS/exFAT /dev/sdb4 418668542 593827839 87579649 f W95 Ext'd (LBA) /dev/sdb5 418668544 490896783 36114120 7 HPFS/NTFS/exFAT /dev/sdb6 490897408 588553657 48828125 7 HPFS/NTFS/exFAT /dev/sdb7 588554240 593827839 2636800 82 Linux swap / Solaris Disk /dev/sdc: 8095 MB, 8095006720 bytes 9 heads, 48 sectors/track, 36598 cylinders, total 15810560 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x1bf0d4df Device Boot Start End Blocks Id System /dev/sdc1 2048 15808511 7903232 7 HPFS/NTFS/exFAT |
You may specify a drive to query this way. I am running Debian 7.1 off an external drive at the moment, so /dev/sda is NTFS.
homer@neo:~/Documents$ sudo fdisk -l /dev/sda Disk /dev/sda: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0008186c Device Boot Start End Blocks Id System /dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT /dev/sda2 206848 234438655 117115904 7 HPFS/NTFS/exFAT |
Run a command on the Linux shell that will be immune to hangups if you are disconnected
The nohup command will allow you to execute a command in an SSH session that will continue to run if you are disconnected. Then you may have peace of mind that your important find command will not be cut off.
For example.
nohup sudo apt-get dist-upgrade & |
Then press ENTER twice. This will run the command in the background.