Pages

Thursday, December 22, 2011

Ubuntu commonly used commands.

Hi all! Here is some useful ubuntu commands which are most commonly used among ubuntu users. Along with some commonly found issues [SOLVED]
To check Installed Ubuntu version
$ lsb_release -a
To check Disk Space:
$ df -Th
To manually Upgrade Ubuntu Version Online:
Press ALT+F2 , type "update-manager -d" without quotes and hit Enter(return) key.
To mount an ISO image as a drive on Ubuntu:
$ sudo mount -o loop ~/Desktop/filename.iso /media/cdrom0
To move the Minimize/Maximize/Close Buttons back the upper right corner of the window.
Hit ALT - F2
Type gconf-editor
Go to the following:
apps --> metacity --> general
Find the button_layout parameter, right click, and select Edit Key
Set the value to the following:
menu:minimize,maximize,close
Do not forget to put the colon . "menu" is not necessary.
To change screen resolution right from Command prompt:
$ xrandr -s 1024*76
To change MAC address of NIC card in Ubuntu:
Type following command either in /etc/rc.local file or at command prompt:
ifconfig eth0 down
ifconfig eth0 hw ether NEW_MAC_ADDR
ifconfig eth0 up
To view or cancel print Job on Unix Printer
1. Login as a user or super-user to unix computer.
2. Use "lpq -Pprinter" command to view printer queue.
$ lpq -Ppsc011
3. Use "lprm -Pprinter [user_id] to cancel your job
$ lprm -Ppsc011 g0xyzqwe
[ Important ] Public key error while trying to run update command
$ sudo apt-get update
gives following error :
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D2B5F4E7C3BB95BB
Solution: Take last 8 characters in the key and run following command
$ gpg --keyserver keyserver.ubuntu.com --recv-keys C3BB95BB
$ gpg --export -armor C3BB95BB | sudo apt-key add -
To download the key on another computer and then to run on your computer :
$ gpg --keyserver keyserver.ubuntu.com --recv-keys C3BB95BB
$ gpg --export -armor C3BB95BB > key.asc
Now Copy key.asc file on your computer and run following command:
$ cat key.asc | sudo apt-key add -
To reflect the changes done in ~/.bashrc file without restarting your Terminal window:
$ source ~/.bashrc
To get Ubuntu Command prompt:
press : Ctrl + Alt + F2 or
Ctrl + Alt + F5
and to get back GUI screen (Xserver):
press: Ctrl + Alt + F7
What to do if ubuntu hangs? Or how to restart Xserver:
press : Ctrl + Alt + Backspace
or press: Alt + Backspace
This usually restarts xserver. You need to login again to the system.
Using Bash History Effectively:
Type the following command to get a list of all related commands with their history numbers:
$ history | grep -i "search string"
Once you've found the command you want, you can execute it specifically by its number
$ !
How to prevent Auto Locking the computer Screen:
1. Open file "/etc/default/acpi-support" and comment following line:
# Comment this out to disable screen locking on resume
LOCK_SCREEN=true
2. Open "System > Preferences > Screen Saver" and uncheck following option:
Lock screen when screensaver is active
How to Merge Multiple PDF files into single PDF file:
Steps:
1. Install two pacakeges GhostScript and PDFtk tools.
$ sudo apt-get install gs pdftk
2. Use following command to combine multiple files into single PDF file. The output file name is "singleCombinedPdfFile.pdf". The input file names are all files in the current directory, bcoz we used "*.pdf".
$ gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=singleCombinedPdfFile.pdf -dBATCH *.pdf
If you want to join PDF files in specific order then you can also use file names.
$ gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=singleCombinedPdfFile.pdf -dBATCH 1.pdf 2.pdf 3.pdf
Wireless Networks: "Wireless is disabled"
$ rfkill list all
You should see both the soft blocked and hard blocked as no. If either of them is yes then the connection would not be enabled. To enable type the following:
$ rfkill unblock wifi
Hard blocked: yes
This suggests that the wireless button is not switched on.