Monday, January 26, 2009

Bash Shell Tutorial

Linux uses the Bourne-again(Bash) shell. A few of the must know commands for working your way through the shell
pwd : show path of present working dir
ls : list contents of pwd
cd : change dir
rm : to delete files, to delete dir use the -r flag with rm
emacs : text editor to open file
su : switch user
sudo : execute a command with temporary root privileges
chmod : change privileges for a file, value 777 specifies r,w,x for root,group and others
ps : list current processes
kill : stop processes that are not responding
poweroff : shutdown system
reboot : reboot system
init : switch between run levels, 5 is the default run level for multi-user, networking and gui
/etc/init.d/gdm stop : to stop the gnome desktop manager and enter shell mode
/etc/init.d/kdm stop : to stop kde desktop manager
startx : start the xserver
ifconfig : configure network adapter
All services are in the /etc/init.d directory

mount : to mount hard drives, cds
mount -t iso9660 /dev/cdrom /media/new : will mount a cd in the new folder in media dir
mount -t ntfs /dev/sda1 /mnt/c : will mount ntfs partition 1(scuzzy device)in c folder in mnt dir
umount : to unmount a mounted drive, if device busy error comes use -l option for lazy unmount
To automount a partition on boot add the mount entry to fstab file in /etc directory

cp : copy
mv : move
man : this is the most useful command, typing man command will give you the manual pages for that command which describe the command in detail and how to use it

ctrl+alt+(F1-F6) : enters any of the six available terminals
ctrl+alt+F7 : switch back to gui mode from the terminal


rpm -i : to install an red package manager package
rpm -e : to remove an installed rpm package

To manually compile a binary executable with a make file, execute the following sequentially
./configure
make
make install

For a complete guide to master the shell commands, refer linux guides like the Red Hat guide. A good video for learning linux is given by CBT nuggets.
The best way to learn linux is through experimentation, use a virtual software if ur reluctant to install linux. Qemu with pendrive linux is what i used to learn and experiment with linux. It is available for download at the following link :
http://www.pendrivelinux.com/portable-qemu-persistent-pendrivelinux/
Using this u can run linux within windows, just like any normal windows app without rebooting or installing anything.

No comments:

Post a Comment

Few Amazing Videos!!!

Loading...