Professional Documents
Culture Documents
Folders/Directories
1.
/
dev
robert
etc
home
media
jenny
root
2.
Report
ls
a.
b.
c.
4.
5.
6.
7.
8.
usr
notes
Log
Touch
touch file.25,qwerty
3.
tmp
jack
Bin
Files
sbin
cd
> ls a
> ls l
> cd
#Takes user to their own home directory
> cd ~robert
#Takes to home directory of robert
> cd ~/Desktop
#~ denotes complete path to home directory
cd ..
#moves up one directory
cd /etc
#moves to the etc directory
Absolute/relative pathnames
> cd /home/jsande/Desktop
#absolute pathname
> cd Desktop
#relative pathname
mkdir <dir name>
#creating a directory
> mkdir sales
> mkdir folder1 folder2
#can create several directories at once
rmdir
#removing a directory
> rmdir sales
rm
#removing a file
rm <filename>
> rm letter
> rm rf sales
#will forcible remove a directory w/ contents
pwd
> pwd
10. man
man <command>
> man who
11. info
12. Exiting
> exit
exit out of shell
> shutdown -h now
shutdown OS
> shutdown -r now
reboot OS
Ctrl-c, Ctrl-d, q, <esc> may get you out of a program
2.
3.
4.
5.
6.
Filenames:
case sensitive: memo5 MEMO5 Memo5
restrictions: do not use *, ?, >, <, /
cp
#Copy a File
cp <source-file> <destination-file>
> ls
output
> cp output outputb
> ls
output outputb
> cp /etc/inittab /root
> cp /etc/inittab . (copies to present dir)
cat
Simple word processor
> cat > notes
To shutdown computer: shutdown h now. <enter>
Ctrl+c
View contents
> cat notes
#Displays content of a text file
> cat n inittab
#-n option: numbers the lines
Opening vi
vi <filename>
Edit/Insert Mode
Command
Action
A
Appends text after the current character
I
Inserts text before the current character
O
Inserts a blank line below the current line
<Esc>
Exits edit/insert mode
Command Mode
Command
Action
:w
Writes to file
:q
Quits editor
:wq
Writes & quits
:w!
Forcefully writes to the specified file
:q!
Quits without saving
Dd
Deletes a line
U
Undoes the last change made
.(dot)
Repeats the last change made
Yy
Yanks the current line, which is to be copied
Nyy
Yanks n lines, including the current line
P
Pastes the yanked text after the current line
X
Deletes character
/<pattern>
Finds the next line containing the specified pattern
:set nu
Numbers each line
more
8.
less
9.
mv
Change Name of File
mv <existing-filename> <new-filename>
> ls
notes inittab
> mv inittab test
> ls
notes test
Move a file to a new location:
mv <filename> <path-to-new directory>
> mv test /home/robert
> cd ~robert
> ls
10.
chmod
11.
4
setuid
2
setgid
1
sticky-bit
# chmod 4511 file1
dr-s--x--x
#Group & others cant read but can execute as if root
# chmod 2710 file1
drwx--s--#Group cant read but can execute as if root
# chmod 1733 file1
drwx-wx-wt
#Prohibits groups & others from changing name or deleting files in a directory
chown
#Changes owner of file/directory
chown <username> <filename>
# chown john file2
# ls l file2
-rw-rw-r-- 1 john users 181 Mar 30 2026 file2
# chown mary:sales file2
#Changes owner and group name
-rw-rw-r-- 1 mary sales 181 Mar 30 2026 file2
chgrp
#Changes group of file/directory
chgrp bill file2
-rw-rw-r-- 1 john bill
181 Mar 30 2026 file2
12.