Unix - Hour 7

Looking into Files

 

7.1.1) This lists the content of current directory and show the type of the files.
internet% ls -F
README*         cis327/         file40          newfile         testdir/
TEST            cis328/         m13com/         prokids/        testme
bugTrack/       cis377/         m1feedback/     public-web/
cis316/         cis396q/        my.new.cmd*     say.hi*
cis325/         file4.doc       new.login       sort.manpage.Z
Command file analyzes the specified files.
internet% file sort.manpage.z README TEST testme
sort.manpage.z: cannot open: No such file or directory
README:         commands text
TEST:           empty file
testme:         empty file
internet% 
7.1.2) This analyzes all the files
internet% file *
README:         commands text
TEST:           empty file
bugTrack:       directory
cis316:         directory
cis325:         directory
cis327:         directory
cis328:         directory
cis377:         directory
cis396q:        directory
file4.doc:      empty file
file40:         ascii text
m13com:         directory
m1feedback:     directory
my.new.cmd:     empty file
new.login:      assembler program text
newfile:        empty file
prokids:        directory
public-web:     directory
say.hi:         commands text
sort.manpage.Z: compressed data block compressed 16 bits
testdir:        directory
testme:         empty file
internet%
7.2.1) Display the files in the very top level (root), their types and arranged by column.
internet% cd /
internet% ls -CF
*perl*           emacs-20.4       lost+found/      root/
-R               etc/             mail/             sbin/
Mail/            export/          mnt/             sshd2_config.mw
TT_DB/           home/            mrtg             tftpboot/
apps/            home1/           net/             tmp/
apps2/           home2/           nsmail/          usr/
awk              home3/           nsr@             var/
bin@             home4/           opt/             vol/
cdrom/           int.df           platform/        web/
dev/             kernel/          proc/            xfn/
devices/         lib@             quotas
7.2.2) Again it analyzes some files located at the root directory.
internet% file bin etc mrtg tmp
bin:            directory
etc:            directory
mrtg:           empty file
tmp:            directory
7.2.3) Moved to /lib directory and again analyzed some files displaying some detailed
       information. Command file works regardless the name of the file.
internet% cd /lib
internet%  file lib.b lib300.a diffh sendmail
lib.b:          c program text
lib300.a:       current ar archive, not a dynamic executable or shared object
diffh:          ELF 32-bit MSB executable SPARC Version 1, dynamically linked, s
tripped
sendmail:       ELF 32-bit MSB executable SPARC Version 1, dynamically linked, s
tripped
 
internet% ls -l /lib/sendmail
-r-sr-xr-x   1 root     bin        6507200 May  6  1999 /lib/sendmail
internet%
7.3.1) Moved to my home directory and displyied the first few lines of file README
internet% cd
internet% head README
*** Congratulations on your first login to GGU's UNIX servers! ***
We endeavor to provide the best education for all of our students,
and have created a short welcome message just for you.
HINT: if you need to scroll down, just hit the <space> bar.
If you ever run into trouble just type `helpme` and a simple form
with contact numbers will appear.
internet% 
7.3.2) Displayied the first 4 lines of file README
internet% head -4 README
*** Congratulations on your first login to GGU's UNIX servers! ***
We endeavor to provide the best education for all of our students,
internet%  
7.3.3) Displayied the first 3 lines of two files at the same time.
       The last file has only one line
internet% head -3 README say.hi
==> README <==
*** Congratulations on your first login to GGU's UNIX servers! ***
==> say.hi <==
echo hi
internet% 
7.3.4) Displayied the first 2 people currenlty logged in the UNIX system.
internet% who | head -2
root       console      May 24 13:01    (:0)
spantaro   pts/2        May 29 21:31    (ip-111-117-52.stockton.navipath.net)
Displays everybody to compare with previous example.
internet% who
root       console      May 24 13:01    (:0)
spantaro   pts/2        May 29 21:31    (ip-111-117-52.stockton.navipath.net)
eitelman   pts/3        May 29 19:49    (adsl-63-201-42-202.dsl.snfc21.pacbell.net)
vochoa     pts/14       May 22 16:28    (pool54-80.ggu.edu)
root       pts/7        May 24 13:02    (:0.0)
internet%
7.3.5) File say.hi and README are executables but I could not see any different result.
       No random junk was thrown in the screen.
internet% head -1 say.hi
echo hi
nternet% head -1 README
internet% ls -F README say.hi
README*  say.hi*
internet%
7.4.1) Displys the last 12 lines of the file
internet% tail -12 README
as a default index page.  I recommend you create your own index.html page
as soon as possible.
WARNINGS:
No "hacking" or "cracking" is allowed.  If you abuse email, IRC, other
peoples accounts or in general cause trouble for the UNIX servers,
network or other networks/hosts, your account will be terminated and the
Dean of Student Affairs will be contacted.
Experimentation and learning is encouraged, but please, remember the rights
of others first!
unix sys admin
internet%
7.4.2) Displays the last 5 lines of the specified files. First file has only one line.
internet% tail -5 say.hi
echo hi
internet% tail -5 README
Dean of Student Affairs will be contacted.
Experimentation and learning is encouraged, but please, remember the rights
of others first!
unix sys admin
internet%
          
7.4.3) This display the last 3 lines of the first 12 lines of specified file.
internet% head -12 README | tail -3
with contact numbers will appear.
LIMITS:
This display the first 12 lines of specified file.
internet% head -12 README
*** Congratulations on your first login to GGU's UNIX servers! ***
We endeavor to provide the best education for all of our students,
and have created a short welcome message just for you.
HINT: if you need to scroll down, just hit the <space> bar.
If you ever run into trouble just type `helpme` and a simple form
with contact numbers will appear.
LIMITS:   
7.5.1) Command cat displays the content of the file.
internet% cd
internet% cat say.hi
echo hi
internet%
7.5.2) Another way to display the last 5 lines of file README. See the whole file bellow.
internet% cat README | tail -5
Dean of Student Affairs will be contacted.
Experimentation and learning is encouraged, but please, remember the rights
of others first!
unix sys admin
internet% cat README
*** Congratulations on your first login to GGU's UNIX servers! ***
We endeavor to provide the best education for all of our students,
and have created a short welcome message just for you.
HINT: if you need to scroll down, just hit the <space> bar.
If you ever run into trouble just type `helpme` and a simple form
with contact numbers will appear.
LIMITS:
disk space= TEN (10) megabytes per user
account expires SIX (6) months from creation.  Extensions are available.
EMAIL:
You currently have a POP3 account.  This enables you to run programs such
as Eudora, Outlook or Netscape to check your email.  The settings you will
need are as follows.
Incoming mail server (POP3) = pop.ggu.edu
Outgoing mail server (SMTP) = mail.ggu.edu
Username = <same as your unix username>
Password = <same as your unix password>
WEBSITE:
Type `makeweb` and a public-web directory will be created for you, as well
as a default index page.  I recommend you create your own index.html page
as soon as possible.
WARNINGS:
No "hacking" or "cracking" is allowed.  If you abuse email, IRC, other
peoples accounts or in general cause trouble for the UNIX servers,
network or other networks/hosts, your account will be terminated and the
Dean of Student Affairs will be contacted.
Experimentation and learning is encouraged, but please, remember the rights
of others first!
unix sys admin
internet%
7.5.3) Display the first line of an executable.
internet% cat -v /bin/ls | head -1
^?ELF^A^B^A^@^@^@^@^@^@^@^@^@^@^B^@^B^@^@^@^A^@^A^Z^P^@^@^@4^@^@M-^_M-$^@^@^@^@^
@4^@ ^@^E^@(^@^U^@^T^@^@^@^F^@^@^@4^@^A^@4^@^@^@^@^@^@^@M- ^@^@^@M- ^@^@^@^E^@^@
^@^@^@^@^@^C^@^@^@M-T^@^@^@^@^@^@^@^@^@^@^@^Q^@^@^@^@^@^@^@^D^@^@^@^@^@^@^@^A^@^
@^@^@^@^A^@^@^@^@^@^@^@^@M-^VM-/^@^@M-^VM-/^@^@^@^E^@^A^@^@^@^@^@^A^@^@M-^VM-0^@
^BM-^VM-0^@^@^@^@^@^@^D^D^@^@   (^@^@^@^G^@^A^@^@^@^@^@^B^@^@M-^Yl^@^BM-^Yl^@^@^
@^@^@^@^@M-(^@^@^@^@^@^@^@^G^@^@^@^@/usr/lib/ld.so.1^@^@^@^@^@^@^@M-^W^@^@^@M-^N
^@^@^@G^@^@^@^@^@^@^@^@^@^@^@^?^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@0^@^@^@^@^@^@^@l^@^
@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^]^@^@^@^@^@^@^@^@^@^
@^@R^@^@^@V^@^@^@^@^@^@^@=^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@M-^H^@^@^@x^@^@^@N^@^@^@
\^@^@^@W^@^@^@*^@^@^@M- ^@^@^@^@^@^@^@M-^@^@^@^@^@^@^@^@^@^@^@,^@^@^@Z^@^@^@^@^
@^@^@^@^@^@^@^@^@^@^@M-^@^@^@^@^@^@^@^@t^@^@^@^^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^
@^@^@^@^@^@^@`^@^@^@:^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@)^@^@^@n^@^@^@<^@^@^@M-^A^@^@
^@7^@^@^@H^@^@^@^@^@^@^@5^@^@^@J^@^@^@r^@^@^@$^@^@^@^@^@^@^@M-^J^internet%
7.6.1) Command more also displays the content of file README placed in my home directory.
internet% more ~/README
*** Congratulations on your first login to GGU's UNIX servers! ***
We endeavor to provide the best education for all of our students,
and have created a short welcome message just for you.
HINT: if you need to scroll down, just hit the <space> bar.
If you ever run into trouble just type `helpme` and a simple form
with contact numbers will appear.
LIMITS:
disk space= TEN (10) megabytes per user
account expires SIX (6) months from creation.  Extensions are available.
EMAIL:
You currently have a POP3 account.  This enables you to run programs such
as Eudora, Outlook or Netscape to check your email.  The settings you will
need are as follows.
Incoming mail server (POP3) = pop.ggu.edu
Outgoing mail server (SMTP) = mail.ggu.edu
Username = <same as your unix username>
--More--(56%) 
7.6.2) Start displying file from line 20.
internet% more +20 ~/README
Incoming mail server (POP3) = pop.ggu.edu
Outgoing mail server (SMTP) = mail.ggu.edu
Username = <same as your unix username>
Password = <same as your unix password>
WEBSITE:
Type `makeweb` and a public-web directory will be created for you, as well
as a default index page.  I recommend you create your own index.html page
as soon as possible.
WARNINGS:
No "hacking" or "cracking" is allowed.  If you abuse email, IRC, other
peoples accounts or in general cause trouble for the UNIX servers,
network or other networks/hosts, your account will be terminated and the
Dean of Student Affairs will be contacted.
Experimentation and learning is encouraged, but please, remember the rights
of others first!
unix sys admin
internet%
7.6.3) Displays file from the first ocurrence found of a specified word that is in the
       file body.
internet% more +/WARNINGS ~/README
...skipping
as soon as possible.
WARNINGS:
No "hacking" or "cracking" is allowed.  If you abuse email, IRC, other
peoples accounts or in general cause trouble for the UNIX servers,
network or other networks/hosts, your account will be terminated and the
Dean of Student Affairs will be contacted.
Experimentation and learning is encouraged, but please, remember the rights
of others first!
unix sys admin
internet%
7.6.4) Displays content of a file located in another directory.
internet% more /etc/passwd
root:x:0:0:Super-User:/:/sbin/sh
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:
sys:x:3:3::/:
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/usr/spool/lp:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
listen:x:37:4:Network Admin:/usr/net/nls:
nobody:x:60001:60001:Nobody:/:
noaccess:x:60002:60002:No Access User:/:
nobody4:x:65534:65534:SunOS 4.x Nobody:/:
lanman:x:100:11:SunLink Server account:/opt/lanman:/bin/false
lmxadmin:x:10869:11:SunLink Server Administrator:/var/opt/lanman/lmxadmin:/bin/sh
lmxguest:x:10870:11:SunLink Server GUEST Login:/home/lmxguest:/bin/false
lmworld:x:10871:11:SunLink Server World Login:/home/lmworld:/bin/false
www:x:97:23:WWW Server:/web/iplanet:/usr/bin/rksh
melvin:x:10872:10::/export/melvin:/usr/local/bin/bash
iac:x:99:10:Infotrac Client Software:/usr/local/iac:/usr/bin/ksh
infotrac:x:95:10:Infotrac Login:/usr/local/infotrac:/usr/bin/ksh
keith:x:11840:1::/home/keith:/bin/sh
--More--(86%) 
1