Wednesday, April 09, 2008

Some Linux Tips

This is mainly from my experience in Red hat Linux 9.0 and Fedora Core (from as far back as 5 years). I have used the double quotes just to highlight the phrase to be typed on the command line. Remove the double quotes and type the commands.

How to check free space in my hard disk?

Typing "free" in your terminal command line lists out all the hard drives details.



"How do I find out the location of an executable file?

which <executable>" will show you the location from which it is called.



How can shutdown my machine with a command/shell script?

Create a shell script and put the following line in it (without the double quotes)

"shutdown -h now"

Executing this shell script shuts down your machine.



How do I mount a network shared folder in my LAN ?

For example sake, assume the network machine name is "nwsys" and the shared folder in that is "shared". Now create a directory to which you want to associate the shared folder to. Lets assume you create a folder "myshare" under "root" directory. Now the command will be

"smbmount //nwsys/shared /root/myshare -o username=<username>,workgroup=<workgroup>"

If all directories exist, you would be asked for the password, enter it. If no error message pops up, you are through.

From FC5, smbfs is removed and the command needs to modified to this:

mount -t cifs //nwsys/shared /root/myshare -o 
username=<myname>,workgroup=<myworkgroup>



I  had disconnected my LAN cable and reconnected it. Now, I am not able to connect to network machines through nautilius.

Close all nautilius windows and execute the following command at the command prompt

"killall nautilius"

This restarts the nautilius service and you should be able to connect to network systems.



 I created a shell script in windows and moved into linux. Here, i set all the requisite user rights for execution. When i tried to execute the script, it gives the error

bad interpreter: No such file or directory
The script seems to be syntatically fine.

This is a problem becaus of the difference in OSes. Open the script in vim and type the following command


:set ff=unix

This converts the script to unix based file format.