Monday, May 31, 2010

BASIC COMMAND FOR VMWARE & LINUX

Directory description
/bin Essential command binaries (programs) are stored here (bash, ls, mount,tar, etc.)
/boot Static files of the boot loader.
/dev Device files. In Linux, hardware devices are acceessd just like other files, and they are kept under this directory.
/etc Host-specific system configuration files.
/home Location of users' personal home directories (e.g. /home/susan).
/lib Essential shared libraries and kernel modules.
/Proc Process information pseudo-filesystem. An interface to kernel data structures.
/root The root (superuser) home directory.
/sbin Essential system binaries (fdisk, fsck, init, etc).
/tmp Temporary files. All users have permission to place temporary files here.
/usr The base directory for most shareable, read-only data (programs, libraries,documentation, and much more).
/var Variable data: mail and printer spools, log files, lock files, etc.

Basic Commands For Navigation

ESX Command DOS/Windows Command Description
pwd cd “Print Working Directory”. Shows the current location in the directory tree.
cd cd,chdir “Change Directory”. When typed all by itself, it returns you to your home directory.
cd directory cd directory Change into the specified directory name.
Example: cd /usr/src/linux
cd ~ . “~” is an alias for your home directory. It can be used as a shortcut to your “home”, or other directories relative to your home.
cd.. cd.. Move up one directory. For example, if you are in /home/vic and you type “cd ..”, you will end up in /home.
cd - . Return to previous directory. An easy way to get back to your previous location!
Is Dir /w List all files in the current directory, in column format.
Is directory Dir directory List the files in the specified directory.
Example: ls /var/log

Special Characters














Character Description
\ Escape character. If you want to reference a special character, you must “escape” it with a backslash first.
Example: touch /tmp/filename\*
/ Directory separator, used to separate a string of directory names.
Example: /usr/src/linux
. Current directory. Can also “hide” files when it is the first character in a filename.
..Parent Directory
~User's Home Directory
*Represents 0 or more characters in a filename, or by itself, all files in a directory.
Example: pic*2002 can represent the files pic2002, picJanuary2002, etc.
?Represents a single character in a filename.
Example: hello?.txt can represent hello1.txt, helloz.txt, but not hello22.txt
[]Can be used to represent a range of values, e.g. [0-9], [A-Z], etc.
Example: hello[0-2].txt represents the names hello0.txt,hello1.txt, and hello2.txt
|“Pipe”. Redirect the output of one command into another command.
Example: ls | more
>Redirect output of a command into a new file. If the file already exists, over-write it.
Example: ls > myfiles.txt
>>Redirect the output of a command onto the end of an existing file.
Example: echo .Mary 555-1234. >> phonenumbers.txt
<Redirect a file as input to a program.
Example: more < phonenumbers.txt
;Command separator. Allows you to execute multiple commands on a single line.Example: cd /var/log ; less messages
&&Command separator as above, but only runs the second command if the first one finished without errors.
Example: cd /var/logs && less messages
&Execute a command in the background, and immediately get your shell back.
Example: find / -name core > /tmp/corefiles.txt &

Working with Files and Directories

ESX Command DOS/Windows Command Description
CattypeDisplay the contents of a text file on the screen.
For example: cat mp3files.txt
Head - Display the first few lines of a text file.
Example: head /etc/services
Tail- Display the last few lines of a text file.
Example: tail /etc/services
tail-f - Display the last few lines of a text file, and then output appended data as the file grows (very useful for following log files!).
Example: tail -f /var/log/messages
CpCopyCopies a file from one location to another.
Example: cp mp3files.txt /tmp
mvMove,ren,renameMoves a file to a new location, or renames it.
For example: mv mp3files.txt /tmp
rmDelDelete a file. Example: rm /tmp/mp3files.txt
mkdirmdMake Directory. Example: mkdir /tmp/myfiles/
rmdirrd,RmdirRemove Directory. Example: rmdir /tmp/myfiles/

Find/Search things

Linux CommandDescription
WhichShows the full path of Shell Commands found in your path.For example,if u want to know exactly where the "grep Command is located on the file system,you cantype "Which grep".The Output should be something like /bin/grep.
where isLocates the Program,Source code,and manual page for a command(if all information is available).For example, to find out where "1s" and its main page are, type "Whereis 1s".The output will look something like:
1s:/bin//1s/usr/share/man/man1/1s.1.gz
locateA quick way to search for files anywhere on the file system.For example,you can find all files and directories that contain the name "mozilla"by typing:
locate mozilla
findA very powerful command,but sometimes tricky to use.It can be used to search for files matching certain patterns as well as many other types of searche.A simple example is:
find . -name \*mp3
This example starts searching in the current directory"." and all sub directories looking for files with"mp3"at the end od their names

Informational Commands

Linux CommandDescription
psLinks currently running process(programs).
wShow who is logged on and what they are doing.
idPrint your User-id's and Group id's.
dfReport File system disk space usage("DiskFree" is how I remember it)
duDisk Usage in a Particular Directory."du -s" provides a summary for current directory.
topDisplays CPU Processes in a full screen GUI.A great way to see the activity on your computer in real time.Type "Q" to quit.
freeDisplays amount of free and used memory in the system.
cat/proc/cpuinfoDisplays information about your CPU.
cat/proc/meminfoDisplays lots of information about current memory Usage
uname -aPrints system information to the screen(Kernel version,machine type,etc.,).

Other Utilities

Linux CommandDescription
ClearClear the Screen
echoDisplay text on the screen.Mostly useful when writing shell scripts.For example:
echo"Hello World"
moreDisplay a file, or program output onpage at a time.Examples:
more mp3files.txt
ls -la | more.
lessAn improved replacement for "more" command".Allows you to scroll backwards as well as forwards.
grepSearch for a pattern in a file or program output.For example to find out which TCP network is used by the "NFS" service,You can do this:
grep "nfs" /etc/services

This looks for any line that contains the string "nfs" in the file "/etc/services" and displays only those lines.
lprPrint a file or program output.Examples:
lpr mp3files.txt - Prints the mp3files.txt files.
ls -la | lpr -Prints the output of the "ls -la" command.
sortSort a file or Program Output.Examples: sort mp3files.txt.
su"Switch user".Allows you to switch to another user account temporarily.The default account to switch to is the root/superuser account.Examples:
su   -Switch to root account.
su-   -Switch to root and log in with root's environment.
su  larry-Switch to larry's account.

No comments:

Post a Comment

acm bottom ad