LAB1_Basic Unix Commands for Solaris Unix

  • View
    451

  • Download
    5

Embed Size (px)

DESCRIPTION

ComputerLabKnow2Pro.com

Transcript

LAB 1 Basic Unix Commands for Solaris Unix . 2

1. 2 GID=1000 (teacher) GID=2000 (student)2.

2 teacher (UID=1001) userxxx (UID=2001, xxx 3 ) Home directory login /export/home

3. 4.

password abcd1234 3 dir. directory

logout login teacher directory 3 login

5.

su group owner directory 3 (student) userxxx

6.

directory 3 home directory userxxx copy directory userxxx.tar /sbin directory

7. 8.

tar directory directory zip tar copy home directory userxxx

9.

10.

su logout login userxxx home directory userxxx

11. 12. 13. Logon

zip tar Telnet localhost

on User: userxxx 14. #who am I Execute commands in background Usually, the shell remains inactive during command execution. Another command cannot be executed until the previous command has completed and the shell displays another command prompt. This is referred to as foreground execution. Altenatively, commands can be executed in background. While a program runs in background, the shell is immediately available to execute another command. ls -al /etc ps pwd

ls -al /etc& ps pwd When do you think background execution is most useful ? sleep 600 Ctrl-z bg jobs ps fg Ctrl-z bg

1.

2 GID=1000 (teacher) GID=2000 (student) #groupadd -g 1000 teacher 1000 group id teacher #group g 2000 student #more /etc/group

student teacher student

2.

2 teacher (UID=1001) userxxx (UID=2001, xxx 3 ) Home directory login /export/home m s /sbin/sh teacher

#useradd u 1001 g teacher -d /export/home/teacher

s /sbin/sh u025

#useradd u 2001 g student -d /export/home/u025 m

user u user id -g user -d directory user -s shell user user #more /etc/passwd -m directory d

user

3.

password abcd1234 #passwd user

password user 2

4.

logout login teacher directory 3 dir. directory 3 login telnet remote #telnet localhost login teacher abcd1234 login folder user /export/home/teacher #pwd directory user 01-03

directory 3 dir. teacher $ mkdir teacher01 teacher02 teacher03

$ ls l directory

dir. dir cd teahcer01 $touch teacher001 teacher003 3 2 dir $ls l

5.

su group owner directory 3 (student) userxxx

$su super user group #chgrp student teacher3

student teacher3 dir. owner #chown user025 teacher3 ls l

6.

directory 3 home directory userxxx dir

#mv teacher3 /export/home/user025

(move) dir. Teacher3

/export/home/teacher/ /export/home/user025 #ls - /export/home/user025

7.

copy directory

/sbin

directory

#cp r /sbin . r dir dir sbin . dir (/export/home/teacher) copy sbin

8.

tar directory directory userxxx.tar tar cvf user025.tar cvf (creat) dir tar

9.

zip tar copy home directory userxxx gzip zip .gz #gzip user025.tar user025.tar.gz zip

copy

copy user025.tar.gz /export/home/user025

#cp user025.tar.gz /export/home/user025

10.

logout telnet #exit

su logout login userxxx

telnet localhost user025 user025.tar.gz

dir. /export/home/user025 ls l

11.

zip tar $gzip d user025.tar.gz

home directory userxxx

user025.tar.gz -d decompress user025.tar

tar

$tar xvf user025.tar

-x excute tar

dir. Sbin teacher1 teacher2

12.

exit telnet

Telnet localhost

13. Logon

on User: userxxx #who am I

login user025 whoami

user

ls -al /etc dir al group owner /etc dir ps process pwd dir

ls -al /etc& dir al group owner /etc dir

& backgroundProcess

ps process ls -al /etc& pwd dir

When do you think background execution is most useful ? sleep 600 600 Ctrl-z Jobs Ps process Bg BackgroundProcess

Fg Foregroundprocess Ctrl-z Bg BackgroundProcess