To list files (DOS dir) use ls
% ls _vti_cnf index.html unix_commands.htm cal man-ps vi cal8 mo who calmo mydir file-example ps
add the -s switch to show the size of files (in blocks) and the total number of blocks used
% ls -s total 40 1 _vti_cnf 2 html.html 14 outline.htm 1 cal 1 index.html 1 ps 0 cal8 14 man-ps 2 unix_commands.htm 0 calmo 0 mo 1 vi 1 file-example 1 mydir 1 who
add the -l switch to show the the LONG version (total number of
files and directories, permissions, owner, size, and timestamp)
% ls -l
total 25
drwxr-xr-x 2 talbert mosaic 512 Mar 21 10:01
_vti_cnf-rw-r--r-- 1 talbert mosaic 134 Mar 20 22:02
cal-rw-r--r-- 1 talbert mosaic 0 Mar 20 22:03
cal8-rw-r--r-- 1 talbert mosaic 0 Mar 20 22:03
calmo-rw-r--r-- 1 talbert mosaic 9 Mar 20 21:50
file-example-rw-r--r-- 1 talbert mosaic 1367 Mar 21 10:00
index.html-rw-r--r-- 1 talbert mosaic 13645 Mar 20 23:45
man-ps-rw-r--r-- 1 talbert mosaic 0 Mar 20 22:04
modrwxr-xr-x 2 talbert mosaic 512 Mar 21 10:01
mydir-rw-r--r-- 1 talbert mosaic 122 Mar 20 21:55
ps-rw-r--r-- 1 talbert mosaic 1102 Mar 21 10:01
unix_commands.htm-rw-r--r-- 1 talbert mosaic 92 Mar 20 23:29
vi-rw-r--r-- 1 talbert mosaic 4 Mar 20 21:53
add the -a switch to see hidden (dot) files too
% ls -a . calmo mydir .. file-example ps _vti_cnf index.html unix_commands.htm cal man-ps vi cal8 mo who
add the -F switch to see directories with a slash (/) appended
% ls -F _vti_cnf/ index.html unix_commands.htm cal man-ps vi cal8 mo who calmo mydir/ file-example ps fpage2.ba.best.com%
We introduce the concept of the shell because we are using GREP to determine which shell a user has. Depending on the Unix administrator's security implementation, you might not be able to see any information in the password file, or you might see encrypted passwords.
The Shell (command interpreter) provides the command line user interface, and there are three main "flavors" of the shell.
The Unix kernel looks in the /etc/password file to determine which shell to launch
Bourne shell uses /bin/sh | basic shell common to all Unix -- by Steven Bourne of AT&T Labs | $ is the prompt |
C shell uses /bin/csh | shell version designed for C programmers -- by Bill Joy, author of vi | % is the prompt |
Korn shell uses /bin/ksh | a version of the C Shell with added features, such as command history -- by David Korn of AT&T Labs | $ is the prompt |
Type grep whitespace doublequote string doublequote whitespace path filename
% grep "talbert" /etc/passwd
talbert:*:1210:020::/home/talbert:/bin/csh
so the user named talbert has the C Shell, which is the most common.
add the -n switch if you also want the line number at which the string appears
% grep -n "talbert" /etc/passwd 127:talbert:*:1210:020::/home/talbert:/bin/csh
add the -c switch if you only want to count the number of times the string appears
% grep -c "talbert" /etc/passwd 1
There are two reasons to use the history command:
use history | more (history pipe to more) to see the history of your commands one screen at a time.
% history | more
27 whoami 29 which albert 30 which talbert .. 104 history 105 history | more
To list processes running, use ps
% ps PID TT STAT TIME COMMAND 4828 p3 Ss 0:00.12 -csh (csh) 15383 p3 R+ 0:00.00 ps
add the -l switch to show the the LONG version
% ps -l UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TT TIME COMMAND 1120 4828 4825 0 18 0 456 272 pause Ss p3 0:00.12 -csh (csh) 1120 15409 4828 1 28 0 376 236 - R+ p3 0:00.00 ps -l