0% found this document useful (0 votes)
7 views4 pages

Ubuntu Lab One

Ubuntu

Uploaded by

abrahamasmamaw4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Ubuntu Lab One

Ubuntu

Uploaded by

abrahamasmamaw4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Ubuntu lab one

Contents:

1. Working with directory


 Making your own directory
 Listing files
 Moving within directory
2. Working with file and file contents
 Working with files
 File contents
3. 1.introduction to users
 Identifying your self
 Adding Users
 Changing Password
 User deletion
 Switching users

Command:<Command name> <space><options><arguments>

1. working with directory

A. making your own directory

command syntax Example use


Mkdir mkdir directory name mkdir dir1 Making directory
mkdir dir2
mkdir -p mkdir –p parent mkdir –p Making parent
directory/subdirectory/tree dir1/subdir1/tree directory
rmdir rmdir directory name rmdir dir1 Removing when no
longer needed
rmdir –p rmdir rmdir –p Recursively remove
parentdirectory/subdirectory/treee dir1/subdir/tree the directories

B. listing Files

command use note


Ls Listing the content of a directory Allfile.txt
ls-a Show all files including hidden files In UNIX hidden file starts with
dot
ls –l Same to ls but it display files with long -rw-r—r—1 paul paul
listing format like time of creation. 24506857 2006 -03 -30 22:53
allfiles.txt
Ls –lh Nearly the same to ls –l but it adds the rw-r—r—1 paul paul 24M 2006
size of file too(24kb) -03 -30 22:53 allfiles.txt

C. moving with in directories

command syntax use


Pwd pwd To display the current
working directory
Cd cd directory name To change the working
directory the directory given
to here
cd.. cd.. To returned back the parent
directory by one level

cd- Cd - To move to the previous


directory.

2. Working with file and file contents


A. working with files

command Use syntax Sample note


Touch touch filename create empty file touch file1 Create empty file1 file
cp To duplicate file cp source 1. Touch CS  coppy the source
with other file or target(file/directory) 2. cp CS IT file( CS) and puts its
directory 3. cp CS SCS coppy on target file
(IT).
 Coppy the content of
source file(CS) and put
on the target
directory(SCS)
cp To copy multiple file Cp source(files and Cp CS IT Copy files CS IT and
to directory directory) target SCS/CS WKU directory SCS and put on
Source: CS IT directory called WKU.
SCS/CS
Target: WKU
cp –r To copy complete Cp –r source target Cp SCS FCS Copy the content of
directory source directory SCS and
put it copy on the target
directoryFSC
cp –i Prevent accidental Cp –i source target Cp-i CS SWE By your reply the file is
deletion Cp: overwrite overwrite or not.
‘CS’?
Mv to rename or move Mv source target 1. Touch os
a file to another 2. Mv os
diretory oper.txt
File Display the type of File filename File file1
file

B. working on file contents

command Use syntax Note


head 1. To display the first  head /etc/passwd  display first ten line of
ten line of file  head -2 /etc/passwd /etc/passwd
2. It is also used to  display two line s of /etc/passwd
display the first n
lines of files
tail Unlike head to display tail /etc/passwd Display ten last ten lines of
thelast ten lines of a file /etc/passwd
cat 1. display contents of  cat filename  display the contents of
specified file  cat file1 file2 file3 filenames specified
2. concatenate texts  cat > filename.txt  display content of file1 file2 file3
3. create file with one  cat > file name at the same time.
or more lines <<stop  After the first line of code cursor
4. create files with one  cat source target will be there, then write the line
or more lines by and press enter after each line.
using stops as ending Finally after completion press
tetxs ctr+d.
5. copy files  No need of using ctr+d, istead
stop will do the task.
 Create taget file which is coppy
of sourcefile
tac Is opposite of cat, display tac file name Use technique of LIFO
in the reverse order

more Display files which have More filename Use space bar to see the next page
more than one page and q to quit

string Displaying ASCII strings Strings filename


from binary files

1. introduction to users
A. adding user

command syntax use


whoami Whoami username Display current user
Useradd Useradd –m –c “comment” –d Create new user
“directory” –s “shell” username
Login Login user name Enter into user account
Usermod 1. Usermod –c “new comment”  Modifying comment setting of user
username  Disabling/locking user by adding
2. Usermod –L user name exclamatory mark behind user password
3. Usermod –U username  Unlocking password by removing
4. Usermod –D username exclamatory mark from encrypted
password.
 Remove user password
B. changing password

command syntax use


passwd 1. Passwd username  Create password for the first time by
2. Passwd another user.
3. Openssl passwd [password]  Changing password by user it self
4. Useradd –m –p “password ”  Display encrypted password of entered
username password.
 Create new user using the encrypted
password as new user password.
C. deleting user and user switching

command syntax use


Userdel 1. userdel user name  remove user from user data i.e
2. userdel –r username /etc/passwd
 remove user data as well as its data
Su Su account name Login to another user if it know its password.

You might also like