Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Ubuntu Terminal (Just need to commands) 3. Go to the home (personal) or th

ID: 3882513 • Letter: U

Question

Using Ubuntu Terminal (Just need to commands)

3. Go to the home (personal) or the root / directory. Try the following “ls” command, examine the results, and explain what it does.

Discuss the ones you are not sure or totally confused in our discussion board. This could be more difficult than you thought. You may

skip it and come back later.

a) ls . b) ls / c) ls *

d) ls ./ e) ls .* f) ls /* g) ls */

h) ls /.* i) ls .*/

j) ls /*/ -d k) ls /* -d l) ls * -d m) ls * -ad n) ls .* -d

Pick any command from h) to n), execute it on the command line, and explain the command and

the result in the submission.

4. Given any directory, use the ls command to display:

all files and sub-directories starting with the letter “D” (note do not list anything in any sub-directory)

its immediate sub-directories (sub-directories only, and no other ordinary files)

its immediate hidden sub-directories only –

5. Assume that the following files are in the working directory:

$ ls

intro notesb ref2 section1 section3 section4b

notesa ref1 ref3 section2 section4a sentrev

2

Give commands for each of the following, using wildcards to express filenames with as few characters as possible.

List all files that begin with “section”.

List “section1”, “section2”, and “section3” 3 files only.

List the “intro” file only.

List “section1”, “section3”, “ref1”, and “ref3” 4 files only.

6. File copy, move, and removal. Use one command to finish each step. You should not use “cd” command at all.

Under your home directory, create a new text file using your campus email id as the file name.

Create a copy of the file in the same directory using any name you like.

Create a subdirectory “backup”.

Move the original file to “backup” and rename it using your first name.

Create a copy of the “backup” directory (and all file in it); name it “backup2”.

Delete “backup”.

Rename “backup2” to “backup3”.

List the files in the new directory.

7. Link

a) Go to your “Documents” directory;

b) Create a file “file1” with the text “hello” in it;

c) Create a hard link named “file2” linked to “file1”;

d) Create a soft link named “soft1” linked to “file1”; create another soft link named “soft2” linked to “file2”.

e) View information of the 4 files (what command should you use to produce some output same to the figure below) – what’s the difference

of these 4 files?

f) Are contents of the 4 files the same? What command do you use to verify that?

g) Create a hard link “file3” linked to “soft1”.

h) Use a text editor (Nano or VIM) to edit “soft2”: change “hello” to “hello, world”. Now, what is the content in each of the 5 files? Are they

the same? What if you change the text in any of these files?

i) Rename “file1” to “change”. Now, how many files can you still open and view the content? Use the same command you used in step e) to

view file information. What’s the change?

j) Use a text editor to edit “file3”: type “Linux” and save. Now what will happen? Which files share the same content? Why?

k) List all files you have now (use the -l option).

8. Translate the following file permission setting between the symbol format and the octal number format.

# Symbol format Octal format

1 rwxr--r--

2 rw-rw-r-x

3 755

4 644

Include the finished table in the submission (#2-7).

9. Review questions (discuss the ones you are not sure or totally confused in our discussion board):

a) How can you create a file named -i? Which techniques do not work, and why do they not work? How can you remove the

file named -i?

3

b) Explain the following error message. Which filenames would a subsequent ls display?

$ ls

abc abd abe abf abg abh

$ rm abc ab*

rm: cannot remove 'abc': No such file or directory

c) Explain the error messages displayed in the following sequence of commands:

$ ls -l

total 1

drwxrwxr-x 2 max pubs 1024 2010-03-02 17:57 dirt

$ ls dirt

$ rmdir dirt

rmdir: dirtmp: Directory not empty

$ rm dirt/*

rm: No match.

d) Directory permission

i. Make sure you are NOT the “root” user for this exercise. Why?

ii. Create a new directory. What is the default permission for this directory?

iii. Create a new file in the new directory. What is the default permission for this file?

iv. Set the directory permission to 400. What does it mean?

v. Set the directory permission to 100. What does it mean?

vi. Set the directory permission to 200. What does it mean?

e) How to set permissions for the following scenarios?

i. You can modify a file but cannot delete it.

ii. You can see the files names (directory content) but you cannot read their contents or modify them

Explanation / Answer

Answer to Ques 3 is Below

a) ls . --> Lists the current directory.

b) ls / --> lists the contents of the root directory

c) ls * --> Lists the current Directory with file arranged under respective folders

d) ls ./ --> (Exactly same as ls .)Lists the current directory .

e) ls .* --> Lists (.bash_history .bashrc .ICEauthority .Xauthority .xsession-errors.old

.bash_logout .dmrc .profile .xsession-errors) of current Directory.

f) ls /* --> List every Directory and file in system

g) ls */ --> Lists the current Directory with file arranged under respective folders

h) ls /.* --> List all folders in (/.:) and (/..:).

They are

bin dev initrd.img lost+found opt run sys var

boot etc lib media proc sbin tmp vmlinuz

cdrom home lib64 mnt root srv usr

i) ls .*/ --> List Current Directory With Additional Information like

.cache/:

compizconfig-1

event-sound-cache.tdb.31aa9e1c8ddfd6fa21d437c4583b2795.x86_64-pc-linux-gnu

evolution

fontconfig

gnome-screenshot

gstreamer-1.0

ibus

indicator-appmenu

logrotate

mozilla

rhythmbox

thumbnails

upstart

vmware

wallpaper

.config/:

compiz-1 gnome-control-center nautilus upstart

dconf gnome-session pulse user-dirs.dirs

enchant gtk-3.0 totem user-dirs.locale

evolution ibus unity

gedit libaccounts-glib update-notifier

.dbus/:

session-bus

.gconf/:

apps

.local/:

share

.mozilla/:

extensions firefox

j) ls /*/ -d --> Lists main Directory as:

/bin/ /dev/ /lib/ /media/ /proc/ /sbin/ /tmp/

/boot/ /etc/ /lib64/ /mnt/ /root/ /srv/ /usr/

/cdrom/ /home/ /lost+found/ /opt/ /run/ /sys/ /var/

) ls /* -d -->Lists

/bin /dev /initrd.img /lost+found /opt /run /sys /var

/boot /etc /lib /media /proc /sbin /tmp /vmlinuz

/cdrom /home /lib64 /mnt /root /srv /usr

l) ls * -d --> simply list current directory

m) ls * -ad --> simply list current directory

n) ls .* -d --> Lists various Direcories like

. .bashrc .dmrc .mozilla .xsession-errors.old

.. .cache .gconf .profile

.bash_history .config .ICEauthority .Xauthority

.bash_logout .dbus .local .xsession-errors

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote