Pages

Wednesday, 24 July 2013

How to Mount Device in Linux and System Commands

How to Mount Device in Linux




How to Mount CD/DVD drive to mnt folder.

#mount /dev/cdrom /mnt press enter ---It will mount the CD/DVD to /mnt folder./

To disconnect.

#umount /mnt press enter ---It will unmount it.

How to mount the pendrive to /mnt folder.

#mount /dev/sdb1 /mnt press enter ---sdb1 is for the pen drive. It will mount the pen drive to /mnt folder. 




System Commands

#system-config-date press enter ---It will show date and calendar.
#system-config-users press enter ---It will open the User manager.
#vim /etc/login.defs press enter ---It keeps information of password policy,userID,groupID.
#system-config-services press enter ---It will show all services.
#system-config-firewall press enter ---It will show firewall configuration.
#system-config-printer press enter ---It will open the printer utility.

#vim /etc/cups/printers.conf press enter ---It shows complete printer information.
#lpr (filename) press enter ---To get printout.
#lpq press enter ---It will show print in queue.
#lpstat press enter ---It will show print in queue.
#lprm 1 press enter ---It will delete the task number 1.
#setup press enter ---It has Authentication, Firmwall, Keywboard, Network, RHN register, system services.

 

How to access another machine remotely in Linux


How to access another machine remotely in Linux






How to access another machine remotely (both machine are linux machine).

GUI

Application >> System >> File Brower press enter.

Go to File >> Connect to server >> Choose SSH and give IP of the other machine and type username and password.

CLI

#SSH (IP address of the other linux machine){It will login as root}
#(type password)

#exit press enter ---To come out the remote machine.

How to Access windows machine remotely.

GUI

Application >> System >> File Brower press enter.

Go to File >> Window share >> Choose SSH and give IP of the other machine and type username and password.


CLI

#mount –t cifs IPaddress:C$ /mnt-0

Username: Administrator

To disconnect

#umount /mnt


Tuesday, 23 July 2013

Linux Basic Commands



 
Basic Commands



# cat > (filename) press enter   --- It will create file.

After pressing enter, type text, press enter

Now press Ctrl +D to save and quit.



# cat (filename) press enter    --- It will show contents of file.



#touch (filename) press enter  --- It will create Empty file.



#mkdir (foldername) press enter --- It will create Folder.



#ls press enter ---show the list of file and folders.



Black color =Normal file

Blue color =Folder name

Green color =Executable file(Script)

Red color =zip, compress files, .rpm (Redhat package manager)



#ls –l press enter --- It shows files and folders with detail.



#rm (filename) press enter ---To remove file.

#rm –f(filename) press enter ---To remove file forcefully.

#rmdir (foldername) press enter ---To remove the Empty Folder.

#rm –r (foldername) press enter ---To remove folder.

#rm –rf (foldername) press enter ---To remove folder forcefully.



#date press enter ---To show date.

#cal (year) press enter ---It will show the year calendar.



#touch .(filename) press enter ---It will hide the file.

#ls –a press enter ---It will show hidden files.

#ls –al press enter ---It will show list of hidden files.



#mv (old filename) (new filename) press enter  ---It will change the file name.

#mv . old filename) (new filename) press enter  ---It will unhide and change the name of file.

#cd (filename) press enter  ---To go into any folder or file.

#cd .. press enter ---To come out of Folder.

#cd press enter ---It will Directly to root directory.

#Clear or #reset press enter ---It will clear the desktop screen.

#history press enter ---To check commands which were run, up to 1000 commands.

#!! Press enter ---To repeat last line.

#!(history  command number) press enter ---It will run the command from history.

#history –c press enter ---It will clear history.



#man command name like

#man ls press enter or #info ls press enter ---It will show help option for ls command.

#whatis ls press enter --- It will show help option for ls command



#history | less press enter ---To see history page by page.

#head (filename) press enter ---It will show top 10 lines.

#head –n 2 (filename) press enter ---It shows top 2 lines.

#tail (filename) press enter ---It will shows last 10 lines.

#tail –n 2 (filename) press enter ---It will show last 2 lines. 

#wc (filename) press enter ---It will show number of lines, words and character in file.

#wc –l (filename) press enter ---It will shows number of linen in file.

#wc –w (filename) press enter ---It will show number of words in file.

#wc –c (filename) press enter ---It will show number of character in file.

#chvt 2,3,4,5,6 press enter ---It will open the new terminal.

#tty press enter ---To check in which terminal we are in.



Reboot commands:



#reboot

#reboot –f

#Init 6

#shutdown –r now



Poweroff Commands:



#poweroff

#poweroff –f

#init 0

#shutdown –n now



If we have install the basic server and we want the GUI interface so, we have run the following commands:



#startx

#gdm

#init 5



To check how many users are logged in.



#w

#who

#users



#whoami press enter ---It will show where are we logged in.

#uptime  press enter ---It will show the uptime of the machine.



#mv (source address) (destination address) press enter ---It will move file from one folder to another.

Example:



#mv (filename) /root (file will move to root folder)



#cp (source address) (destination address) press enter ---It will copy the file.

Example:



#cp (filename) /root



#cp –r (source address) (destination address) press enter ---To copy the Folder.



#cp –rv (source address) (destination address) press enter ---To copy the Folder and to see what is coping.



#vi (filename) press enter ---To modify and create file.

Press (i) to insert text.

Press (esc) to stop writing.



:wq ---For quit.

:q! ---for force quit without save.



#vim (filename) press enter ---To modify and create file.



#nano (filename) press enter ---To modify and create file.

#gedit (filename) press enter ---To modify and create file.



#vim /etc/motd press enter ---For welcome note.



#fdisk –l press enter ---To see partition of disk.

#cat /proc/partitions press enter ---To see partition.

#df –h press enter ---To check the partition.



#du –h (folder name) press enter ---To see the content of folder.



#cat /proc/cpuinfo press enter ---To check CPU information.



#cat /proc/meminfo press enter ---To check memory information.



#free –m press enter ---To check memory.





#uname press enter ---It will show the Linux.

#uname –r press enter ---It will show the Kernel version.

#uname –a press enter ---It will show the complete configuration.



#grep (anyword) (filename) press enter ---Its will find anyword from the file.



#find (filename) press enter ---It will show the format of the file.

#ifconfig press enter ---It will show the ip address.



#system-config-network press enter ---To configure the Network setting.

Device config press enter

Select eth0 press enter and save it.

Select Network configuration page and type Ip address.



#ifup eth0 press enter ---It will activate the LAN card.

#vim /etc/sysconfig/network-scripts/ifcfg-eth0 press enter ---It will open the LAN config file.