Tips For Linux Beginners:Part 1
Posted by kranny on August 16th, 2009;This post is viewed 916 times
Ahem!!An Update from Tuxfreaks.There will be 2 Posts a month exclusively for the linux beginners .I need to drive some traffic[:P].As the title says, it is just not for the beginners but also comes handy to the evry Linux user.So here we Go
How to find out which application or process is using your port
The simplest way to find is to use lsof command
Example :If i need to find which application is using the port 61136,i need to
lsof -i tcp:61136
which gives me the output:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
uTorrent. 3364 kranny 19u IPv4 10656 TCP *:61136 (LISTEN)
Covert Ext2 to Ext3 Filesystem
Ext3 is a journal extended file system and journalized file system are always advantageous than non-journalized ones(Ext2).so i adivise using ext3 and plan ahead for ext4 with -I 256 byte i nodes.Don’t confuse with the word journaling,for the time being just understand that you don’t have to fsck after a crash.
To convert partition to the ext3 filesystem,cleanly unmount them and,on a console,
tune2fs -j /dev/hdaX
Modify the lines in your /etc/fstab to reflect that the partitions in question are to be mounted as ext3.you are just a reboot faraway from making your partitions as ext3.
Default behavior of Ctrl+Alt+Delete
Many of the windows users out there might have the habit of pressing the Ctrl+Alt+Del keys whenever any process hangs.It opens up the task manager and you can proceed form there.But the Default behavior in Linux is to reboot the system.Imagine u have not saved any of your work and used the combination of those keys.Before you curse yourself for doing so,Why dont you change the behaviuor of it.
Modify Ctrl-Alt-Del Behavior in Linux
I hate the Ctrl-Alt-Del combination, maybe because it reminds me of the unpleasant days when I used other operating systems. If you want to modify it, then here is how to do this:
In Ubuntu
Open the file /etc/event.d/control-alt-delete (You need super user privileges)
You should see a line similar to this:
exec /sbin/shutdown -r now “Control-Alt-Delete pressed”
Which binds ctrl-alt-del to rebooting your computer. Change it to execute any other program you want. Of course you can disable it completely by commenting the whole file.Open /etc/inittab file and you should see something like this:
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
To disable ctrl-alt-del, just comment this line. To bind it with other program, just replace “/sbin/shutdown -t1 -a -r now” with the program you want to execute.
In Ubuntu you dont have the inittab file.Instead modify /etc/event.d/control-alt-del file
exec /sbin/shutdown -r now “Control-Alt-Delete pressed”
change it to
exec /usr/bin/gnome-system-monitor
or anyother program you wish to invoke.
Save Your Command History Of a Session
Did you ever think how handy it is to save the command history to a file and use it for future reference.Its just a matter of two commands and there you go.
root@kranny-desktop$ script filename
and there starts your logging until you type exit
root@kranny-desktop$exit
You can view the history in the file “filename”
To kill a process/hung up GUI Application
It is indeed easy to kill a process issuing the kill command with the respective process PID as an argument.Well its a long process to find out the PID of the process you are going to terminate.how about this?If you want to kill firefox
pgrep firefox | xargs kill
And if you want to kill a GUI application,open up your terminal and type
xkill
This would change your cursor to a ‘X’ and just click on the window you would like to terminate




August 16th, 2009 at 10:38 pm
In Ubuntu
Open the file /etc/event.d/control-alt-delete (You need supper user privileges)
Learn to proofread.
Quote
August 17th, 2009 at 8:20 am
edited [:P].Thanks for the feedback.
Quote
August 18th, 2009 at 7:33 pm
[...] Tuxfreaks: Tips for Linux Beginners (1st part in an ongoing series) [...]