Monday, December 23, 2013

Skype Audio not working on Ubuntu

If you are having audio problems while using Skype on Ubuntu, first check to ensure that sound is working on your system and that your microphone and speaker volume levels are high enough. If you cannot hear yourself using the Skype Echo Sound Test, its possible that pavucontrol is not installed on your system. To install it, use the command :

sudo apt-get install pavucontrol

Restart Skype. Now the audio should work fine.

vmlinuz not found

While installing Ubuntu using a flash drive, you might get an error saying : /casper/vmlinuz not found. You cannot proceed with the installation until you correct it. To do this, you need to rename a file on the flash drive. You could log into another OS on your computer (if you have one) or use another computer.

1. On the flash drive, go to the directory vasper
2. Find a file named vmlinuz.efi
3. Rename that file to vmlinuz
4. Restart and boot using the flash drive. Now you'll be able to proceed with the installation. 


Saturday, December 14, 2013

Changing computer name on Ubuntu

To change the computer name on Ubuntu, you need to do the following :

First, you need to edit /etc/hostname file. To do this, run the following command :

sudo vim /etc/hostname


Change the name as required. After that save and exit ( Use :x to save and exit).

Now, you need to edit /etc/hosts file. To do this, run the following command :

sudo vim /etc/hosts


In the file, you might see something like :

127.0.0.1       localhost

127.0.1.1       "your computer name"

Change the text next to 127.0.1.1 to the name you like. Save and exit.

The changes will be applied when you restart the system. To apply changes without restarting, use the following command :

sudo service hostname restart

This is how the /etc/hosts file would look :

Monday, November 25, 2013

Ubuntu 13.10 crashes after Suspend

Firstly, make sure you have installed the proprietary drivers for your graphics card. For installing Nvidia drivers for Ubuntu, check out this post. If you continue to have problems even after this, then follow these steps.

sudo gedit /etc/default/grub

Find the line :

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

and replace it with :

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pcie_aspm=force"

And run the command :

sudo update-grub

Tuesday, November 19, 2013

Creating multiple directories in Linux

For creating multiple directories, you can either specify the names using commas or you can specify a range.

mkdir file{1,2,3}

or

mkdir file{1..5}


Tuesday, November 12, 2013

Can't detect Android phone on Ubuntu 12.10

Apparently, this is a common problem in Ubuntu 12.04 and Ubuntu 12.10.

sudo add-apt-repository ppa:langdalepl/gvfs-mtp
sudo apt-get update

After running these commands, restart the system. After restart, your Android phone internal data storage will be listed in the devices automatically.

Saturday, November 2, 2013

Hidden Directories in Linux

In Linux, directory (folder) names starting with a '.' are not visible to users. To view these files, you need to use the command :

ls -as

This command displays all the directories within the current directory. If you want to rename the directory. Suppose the name of the directory is direc. Then :

mv -i .direc direc

You will find that the hidden directory is now visible.

Thursday, October 17, 2013

Installing Skype on Ubuntu

To install Skype on Ubuntu, follow these steps :

sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update
sudo apt-get install skype

After the installation, type skype in the terminal to open it.


Installing Nvidia Drivers on Ubuntu

Without installing the display drivers, you will notice that the performance is the system is pretty poor, which becomes clearly visible while watching videos. So here's how you install the Nvidia drivers on Ubuntu :

sudo apt-get install build-essential linux-source linux-headers

After running this command, you might get an error saying : Package 'linux-headers' has no installation candidate. Ignore the error and continue to the next step.

sudo apt-get install linux-headers-`uname -r` 

sudo apt-get install nvidia-current 

Saturday, September 21, 2013

Executing .run files in Linux

To be able to execute .run files, they first need to be converted to executable files. Use the command :

chmod +x [[filename]]

Then use the following command to execute :

./[[filename]]

Installing Adobe Flash Player on Kali Linux


To install Adobe Flash Player on Kali Linux, follow these steps :

1. Download Adobe Flash Player (.tar.gz) from http://get.adobe.com/flashplayer/ and save it in the root folder.

2. Now untar it using the command :

tar -xvzf [[name of the package]]

3. Change to directory usr/lib64/kde4 (if you are on a 64-bit machine) or usr/lib/kde4. Run the command :

cp kcm_adobe_flash_player.so /usr/lib/mozilla/plugins/

Error while installing Firefox on Kali Linux

I tried installing Firefox and got an error like this :

root@Hari:/home/harichandan# apt-get install firefox-mozilla-build
Reading package lists... Done
Building dependency tree       
Reading state information... Done
wine is already the newest version.
wine set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/29.7 MB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: error processing firefox-mozilla-build (--configure):
 package firefox-mozilla-build is not ready for configuration
 cannot configure (current status `half-installed')
Errors were encountered while processing:
 firefox-mozilla-build
E: Sub-process /usr/bin/dpkg returned an error code (1)

So to get around this, you just need to run the command :

apt-get install --reinstall firefox-mozilla-build

Thursday, September 19, 2013

How to change ROOT password in Linux

Enter the command passwd.

Then choose the password you want!

Tap Clicking Not Working on Linux

This has happened quite a few time for me. No matter how much I fiddled with the system settings I couldn't get it working. There's a simple command which you need t run and it will work.

synclient tapbutton1=1 

Saturday, August 24, 2013

Installing Aircrack-NG on Linux

Aircrack-ng is an 802.11 WEP and WPA-PSK keys cracking program that can recover keys once enough data packets have been captured. Fir installation, run the following commands :


sudo apt-get install build-essential

sudo apt-get install libssl-dev

wget http://download.aircrack-ng.org/aircrack-ng-1.1.tar.gz

tar -zxvf aircrack-ng-1.1.tar.gz

cd aircrack-ng-1.1


Edit the file common.mak before you run make and make install.
sudo gedit common.mak

Locate and change the unused variable werror. Change :
CFLAGS          ?= -g -W -Wall -Werror -O3

to

CFLAGS          ?= -g -W -Wall -O3


Now run :
sudo make
sudo make install 

After the installation, if you get a prompt as follows :
[*] Run 'airodump-ng-oui-update' as root (or with sudo) to install 
or update Airodump-ng OUI file (Internet connection required). 

Then run the command :
sudo airodump-ng-oui-update

Friday, August 23, 2013

Installing ettercap on Linux

Ettercap is a comprehensive suite for man in the middle attacks. It features sniffing of live connections, content filtering on the fly and many other interesting tricks. It supports active and passive dissection of many protocols and includes many features for network and host analysis.

For installing ettercap, use the following commands :

sudo apt-get install zlib1g zlib1g-dev
sudo apt-get install build-essential
sudo apt-get install ettercap

You will be prompted to choose between ettercap text-only and ettercap-graphical packages. Choose accordingly.


For installing ettercap-graphical, use the command :

sudo apt-get install ettercap-graphical


For installing ettercap-text only, use the command :

sudo apt-get install ettercap-text-only
 
After the installation is done, you can open ettercap in different modes. For opening ettercap in graphic mode, use :


sudo ettercap -G


For text mode, use

sudo ettercap -T


To read about ettercap and its different modes, you can use :


man ettercap


Note : 'man' is short for manual. It can be used to read about all commands (description, syntax etc.)

Thursday, August 22, 2013

Capturing Packets using Wireshark

To start the capture of packets, select the interface from the left panel and click on Start.

Once you click on start, you'll notice that the capture of packets has begun and all the packets to and from your computer starts appearing.


If you just want to see a paticular type of packets, say ARP, HTTP etc., you can also add a filter. In the top left corner, type the desired type of packet. Only that type of packet will appear.

Wednesday, August 21, 2013

Cropping an image in Linux using GIMP

Cropping an image is a pretty basic feature in image editing software. Its pretty easy to do in Windows. You can even use Paint to do it in Windows. But I had a tough time doing it on Ubuntu. But its pretty easy to do it on GIMP. Here's how.

1. Open the image you want to crop on GIMP.

2. In the Toolbox, you have to look for the Crop Tool.


3. Use the Crop Tool to select the area you want to crop and click on the small rectangular box within the selected area to crop.


  4. You get the cropped image. Use Ctrl+S to save the image. Use Ctrl+Q to quit GIMP.

Installing MATLAB on Linux

I recently downloaded a MATLAB image to install on Linux thinking that it would be a walk in the park like Windows. But it wasn't. There a few things you need to take care of before installing MATLAB on Linux systems.

Firstly, you need to have Open JDK installed. I have read about people having problems installing MATLAB with Open JDK Java 7 (latest version). If you do, then  install Open JDK Java 6 and it should work fine.

In Windows you can just extract an ISO file and run the .exe file to install the software. But that doesn't work in Linux. First you need to mount the ISO. Ofcourse you can install some software for mounting with a GUI but I am going to tell you how to do it using commands.

To mount the ISO file, check this link here.

After mounting the ISO, enter the mounted drive using the following commands :

cd /mnt/disk

Now you can check the  files in this directory using ls command. You should find a file named install in the directory. Now use the commad :

./install

This should start the installation.

 

After the installation, you will be prompted to activate your software. Choose the option that suits you. Since I had the activation file, I chose the option Activate Manually without Internet. 



After activating the software, MATLAB is ready to use. Now you can unmount the ISO file. For help on unmounting an ISO file, click here.  

Sunday, August 18, 2013

Mounting & Unmounting an ISO in Linux

Mounting an ISO

To mount an ISO in Linux, you need to follow these steps :

Firstly, you need to create a directory where you will be mounting the ISO. You can do so using the command :

sudo mkdir -p /mnt/disk


Next, we mount the ISO file using the command :

sudo mount -o loop [filename].iso /mnt/disk


If you get an error saying that loop is not up, first load the loop module and then repeat the mount command. To load the loop module, use the command :

sudo modprobe loop


Note that you can always use TAB key to auto-complete the filename. -o loop is used to denote the mounted ISO file is a loop device. A loop device is a pseudo-device which writes/reads from a file rather than a hardware.

Unmounting an ISO

To unmount an ISO file, use the command :


sudo umount /mnt/disk

Use the following command if you are getting an error :


sudo umount -f /mnt/disk

Note that it is 'umount' and not 'unmount'. 

Saturday, August 17, 2013

Moving Close, Maximise and Minimise Buttons to Right Side in Linux

If you are a windows user, then the one thing that you would find most annoying is the close, maximise and minimise buttons being on the opposite side. It can be done in a couple of ways. Just run this command to have the buttons on the right :

gconftool-2 --type string --set /apps/metacity/general/button_layout "menu:minimize,maximize,close"


If the above command doesn't work, try this :

gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"

It is also possible to do it using gconf-editor. If gconf-editor is not installed on your system, you can do so by searching it in the software centre. To change the buttons to right, follow these steps :

1. Press Alt+F2. This should open the Run Application window.
2. Type gconf-editor as shown.
   

3. In the editor, select apps -> metacity -> general.
4. In the value field of button_layout, change close,minimize,maximize: to menu:minimize,maximize,close  


Deleting a directory in Linux

To delete a directory in Linux OS, we use the command :
rmdir
or
 rm 

The syntax is :

rmdir [directory path]
But the rmdir or rm command works only for an empty directory. For deleting a directory, we need to perform what is called a Recursive Delete. Recursive Delete deletes the directory, its sub-directories and all the files contained within. To perform a recursive delete, we use the command :

rm -rf [directory path]

Obviously it doesn't make sense to have to run a command if you could do it manually. But sometimes, you cannot delete directories as a normal user and you will get an error saying you do not have necessary permissions. So you need to be a super user to do so. Use the command as follows :

sudo rm -rf [directory path]

Thursday, August 15, 2013

Installing Wireshark

Wireshark is a network protocol analyzer. If you are networking geek, its a software you would definitely have on your system. Whether you are looking at network troubleshooting, analysis, software and communications protocol development or just as a hobby, Wireshark is your go-to tool.
To install on Windows, you download the latest release from here. Each Windows package comes with the latest stable release of WinPcap, which is required for live packet capture. If needed you can install the latest development release from here.
To install on a Linux system, you can run the command :
yum install wireshark (Fedora/CentOS)

sudo apt-get install wireshark (Debian/Ubuntu)
After the installation, to run Wireshark, type wireshark in the terminal.

How to repair MBR in Windows 7?

When you install a Linux OS on your system, the Master Boot record (MBR) gets replaced by GRUB (GRand Unified Bootloader). If you decide to uninstall the Linux OS and go back to your Windows system, you need to fix your MBR. You have to follow these steps for that :

  1. Put the Windows 7 installation disc in the disc drive (or a bootable Windows 7 USB), and then start the computer.
  2. Select a language, a time, a currency, a keyboard or an input method, and then click Next.
  3. Click Repair your computer.
  4. Click the operating system that you want to repair, and then click Next.
  5. In the System Recovery Options dialog box, click Command Prompt.
  6. To restore the MBR, simply type : bootrec /fixmbr

Wednesday, August 14, 2013

Essential Shortcuts & Commands in Terminal

Ctrl + Shift + T - Open a new tab within the Terminal
Ctrl + Shift + C - Copy
Ctrl + Shift + V - Paste
Tab Key- Autocomplete the command if there is only one option, or else show all the available options.
Ctrl + C- Kill the current process (works mostly with small text-mode applications)
Ctrl + Z - Send the current process to the background.
clear - Clears the screen
ls - List all the contents of the current directory
cd - Change the current directory
exit - It will get you out of the shell

FAQs by Linux Newbies

How do I become "root"?
To become "root" on a Linux system, type :
su -
You will be prompted to enter your root password (you set this while installing your OS), entering which you will become the root of the system. Becoming the root will give you access to all the commands on the computer.
How do I change the GRUB boot order?
GRUB boot order can be configured using the file /etc/default/grub . Use the following command :
gedit /etc/default/grub
This command opens a window with the GRUB file. In this file, you will notice that there's a line :
GRUB_DEFAULT=0
In the list that appears at the start up, the Linux OS appears first. Here, the indexing starts from 0. So the first option on the list will have a value 0, second option has value 1 and so on. Check the position of your Windows OS and change the value of GRUB_DEFAULT.
Also, if you can change the amount of tume you have to wait during the boot time by changing the value of GRUB_TIMEOUT.
How do I untar a .tar.gz file?
Any compressed file can be decompressed by choosing "Extract Here" after right clicking on the file.
Command to untar a file is :
tar -xvzf 
Is there a Task Manager equivalent in Linux?
Yes there is. While logged in as root, type
ps -ax |more
or
ps -aux |more
You will get a list of all processes running on your computer. You will see the process id (PID), process status (STAT) various statistics, and the command name. You can kill a process by typing "kill" and the PID number right afterwards similar to the line below.
kill 1721
You can also stop and restart processes by sending them various signals as in the below examples:
kill -STOP 1721 - Stops (suspends) process 1721 by sending the STOP signal to the process. This process will still be on the task list. The process can't catch or ignore the STOP signal.
kill -CONT 1721 - Continue process 1721 causing it to resume. The CONT signal is sent to the process.
kill -TERM 1721 - Terminates process 1721 by sending the TERM signal to the process. This process will no longer show up on the task list if it is actually terminated. Process terminated cannot be continued. The TERM signal can be caught so TERM is not guaranteed to kill the process.
kill -HUP 1721 - Stops, then restarts process 1721. This is usually done when a process is not working properly or the configuration files for that process have been changed. This command sends the HUP signal to the process which means hangup. This signal can be caught by the process.
killall -HUP myprint - Restarts any process with the name "myprint".
kill -TERM myprint - Terminates any process with the name "myprint".

Monday, August 12, 2013

Commonly used Linux Commands

1. ls command

ls command is used to list the contents of the current directory.

2. cd command

cd command is used to change directories.

cd . - Takes you to the parent of the current directory
cd - Takes you to the root directory
cd PATH - Takes you to the specified PATH

3. uname command

It is used to print system information.

-a, --all
print all information, in the following order:
-s, --kernel-name
print the kernel name
-n, --nodename
print the network node hostname
-r, --kernel-release
print the kernel release
-v, --kernel-version
print the kernel version
-m, --machine
print the machine hardware name
-p, --processor
print the processor type
-i, --hardware-platform
print the hardware platform
-o, --operating-system
print the operating system
--help
display this help and exit
--version
output version information and exit

Things to do after installing Linux

When I installed Fedora 18, I realised that it doesn't include most of the software I am used to in Windows. Luckily, almost all the software that are available for Windows are available for Linux distros as well (atleast close substitutes). This is not an exhaustive list! Just to give an idea as to how to go about things.
Remember to run all the commands as super user, i.e., type ' su - ' first. You will be prompted to enter your password. After entering the correct password, you enter the root of your system, similar to admin in Windows.
1. Fedora Utils
Fedora Utils lets you install codecs and additional software that Fedora doesn't want to ship, like MP3 codecs, Adobe Flash, Oracle Java etc. It can also fix problems, tweak and cleanup your system, show system information and much more with just few clicks.

su -c "curl http://download.opensuse.org/repositories/home:/satya164:/fedorautils/Fedora_19/home:satya164:fedorautils.repo -o /etc/yum.repos.d/fedorautils.repo && yum install fedorautils"

2. VLC Media Player & Media Codecs

I find VLC more convenient to use than the default player that comes with Fedora, so that's usually the first thing I prefer installing.
yum install vlc
yum install gstreamer gstreamer-ffmpeg gstreamer-plugins-bad gstreamer-plugins-bad-free gstreamer-plugins-bad-nonfree gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-ugly ffmpeg
3. Adobe Flash Plugin
You have to chose either based on the hardware architecture you are using.

x86_64 (64 bit)

sudo yum install http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm -y 

x86 (32 bit)


 sudo yum install http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm -y

Install the Adobe Flash web-browser plugin
The first command imports the GPG key for the Adobe Flash plugin repository and the second command installs the plugin itself.
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
sudo yum install flash-plugin -y
4. GNOME Tweak Tool
GNOME Tweak Tool is an application for changing the advanced settings of GNOME 3.
yum install gnome-tweak-tool
5. Installing Java Runtime Environment
For installing JRE, download the package required/ You can download the latest package from here or the previous releases from here. There are a variety of formats available and you can choose whichever suits you the best. Since I use a Fedora system, it would be *.rpm for me.
rpm -Uhv *.rpm
6. WINE
Wine is a free and open source software application that aims to allow applications designed for Microsoft Windows to run on Linux operating systems.
yum install wine
7. GIMP
GIMP is an open source equivalent of Adobe Photoshop.
yum install gimp
8. Audacity
Audacity is free, open-source audio editor for recording, slicing, and mixing audio.
yum install audacity --disablerepo=LumenVox
9. Clementine Music Player
You do find some default music players on Linux like Rhythmbox or Brasero, but I found this music player really ineresting.

sudo add-apt-repository ppa:me-davidsansome/clementine
sudo apt-get update
sudo apt-get install clementine

Upgrading Fedora using yum

For upgrading Fedora, you have to install a script called 'fedora-upgrade'. After installing this script, you just have to run the script for the upgrade. Use the following commands :
# yum install fedora-upgrade
# fedora-upgrade
For upgrading from Fedora 18 to 19, follow this procedure :
# rpm --import https://fedoraproject.org/static/FB4B18E6.txt
# yum update yum
# yum --releasever=19 distro-sync

Downloading YouTube Videos on Linux

There are many YouTube Downloaders available on net but I use a very simple command line program called 'youtube-dl' to download videos.

Installing youtube-dl

yum install youtube-dl (For Fedora/CentOS)
          sudo apt-get install youtube-dl (For Debian/Ubuntu)

How to download videos
youtube-dl - This command will download the video into your Downloads folder.
If you want to specify the download folder, then use the following command :
youtube-dl -o /home/"YourPATH"
This command can be used for downloading any video and is not limited to YouTube.

12. PTP Router (Precision Time Protocol Router)

a. NetFPGA Base Version : v2.0
b. PTP Package : PTP Router 1.0.0
After downloading this package, merge it with the NF2 folder in root.
c. After this, compile and load the driver again, i.e., use the following commands :
  1. cd ~/NF2
  2. make
  3. make install
d. Regression Tests : Regression tests for PTP Router are the same as those for reference router.
RESULTS
e. Building the software : For building the software, use the following command :
  1. cd NF2/projects/ptp_router/sw
  2. make install
  3. cd scone-ptp
  4. make
f. For running the PTP project, go to the directory sw/scone-ptp and use the command ./scone.
Sample Output : Follow the link


 

Tuesday, August 6, 2013

11. Regression Tests

Regression tests are a set of tests that exercise the functionality of the released gateware and software. The following are the initial tests that need to be followed :
1.Go to : Systems -> Administration -> Server Settings -> Services  and stop all the processes (except the process network) that are running (time consuming but has to be done). I had once faced a problem of not being able to open the Systems  due to insufficient rights (dunno how that happened as I was the only user on the computer). For that, you can log into the  root and type : system-config-services.
2. IPv6 needs to be disabled. This can be done as follows :
a. Type : /sbin/chkconfig ip6tables off
b. Type : gedit /etc/modprobe.conf and add the lines :
alias ipv6 off
alias net-pf-10 off


 c. Edit network file using the command : gedit /etc/sysconfig/network and make the sure the following line is there : NETWORKING_IPV6=no



Regression Tests
1. Connect 'eth1' to 'nf2c0' and 'eth2' to 'nf2c1'.
2. Connect 'nf2c2' to 'nf2c3' (Leaving these ports unconnected causes errors in the regression tests).
3. Pull up all the interfaces :
ifconfig eth1 up
ifconfig eth2 up
ifconfig nf2c0 up
ifconfig nf2c1 up
ifconfig nf2c2 up
ifconfig nf2c3 up
And assign an IP address of 0.0.0.0 to all of them. This is done to remove the IPv4 address for each interface.
ifconfig eth1 0.0.0.0
ifconfig eth2 0.0.0.0
ifconfig nf2c0 0.0.0.0
ifconfig nf2c1 0.0.0.0
ifconfig nf2c2 0.0.0.0
ifconfig nf2c3 0.0.0.0
Now reprogram the CPCI using : /usr/local/sbin/cpci_reprogram.pl -all
Write the bitfile onto the NetFPGA using : nf_download ~/netfpga/bitfiles/reference_router.bit
Now start the regression tests using : ~/netfpga/bin/nf_regress_test.pl 
RESULTS