Wednesday, July 27, 2011

Linux Commands

General Commands

Q.How to write a boot image from your hard disk to a floppy
A.dd if=boot.img of=/dev/fd0

Q.How to copy the boot image from your hard disk to a floppy
A.dd if=/dev/fd0 of=floppy.img

Q.How to search for a file arul.jpg recursively in your Unix account
A.find ~/ -name "arul.jpg"

Q.How to display all the processes running on the host
A.ps -af

Q.How to check the current quota and tell how much you have used
A.quota

Q.How to check disk space in a directory (say /usr)
A.du -s -H /usr

Q.How to report size (in kBytes) of all enclosed directories (recursive)
A.du -k

Q.How to report size (in kBytes) of all enclosed directories (non-recursive)
A.du -ms *

Q.How to list login IDs of users currently logged in to the system
A.users

Q.How to change the permanent information kept by the system about your logon ID
A.chfn


Administrator commands lines:


Q.change user's shell to /usr/bin/bash (user arul):
A.usermod -s /usr/bin/bash arul

Q.access a windows (only FAT or FAT32) partition (say hda2) under linux
A.mount -t vfat /dev/hda2 /win

Q.allow root user and other users(where user id=500) to get rw permission for that windows partition
A.mount -t vfat -o uid=500 /dev/hda2 /win

Q.list all device files corresponding to hda
A.fdisk -l /dev/hda

Q.track down symbolic links, for example, to see where xterm points to
A.namei /usr/X11/bin/xterm

Q.print Linux version information
A.uname -r

Q.measure hard disk speed
A.hdparm -tT /dev/hda

Q.print hardware summary
A.more /proc/cpuinfo

Q.check inode usage of all mounted partitions
A.df -i

Q.monitoring the system for the growth of a file
A.tail -f /var/log/messages



No comments:

Post a Comment