General-purpose UNIX commands

Assignment Help Other Subject
Reference no: EM133140271

KIT501 ICT Systems Administration Fundamentals - University of Tasmania

Goal

The main purpose of this second UNIX tutorial is to give you familiarity with the UNIX file system and some more general-purpose UNIX commands.

Exercises
Under your home directory, create a new directory named kit501
$ mkdir kit501

Check to see that the new directory has actually been created
$ ls

10 minutes ago you created two text files named f1.txt and f2.txt. Now move them into the kit501 directory. If you did not create the two files, go back to the pages which contain the instructions for using joe or nano command for creating text files:

$ mv f1.txt kit501
$ mv f2.txt kit501
Change into this new directory:
$ cd kit501

Are you really under this new directory now?

$ pwd

Are there any files currently stored under this new directory? Can you see f1.txt and
f2.txt?

$ ls

You may have forgotten the contents of f1.txt and f2.txt. Can you check them?

$ cat f1.txt
$ cat f2.txt

Can you try to change file names?

$ mv f1.txt f3.txt
$ mv f2.txt f4.txt
Have the names been changed?

$ ls

OK you know it's easy to change file names, so you will change them back to their original names:

$ mv f3.txt f1.txt
$ mv f4.txt f2.txt

Next, make some copies of f1.txt:

$ cp f1.txt file01.txt

(Note: pressing the UP arrow key brings back a previously entered command, which saves trouble in typing longer command lines)

$ cp f1.txt file02.txt
$ cp f1.txt file001.txt
$ cp f1.txt file002.txt
Have you really made some copies of f1.txt?

$ ls

Next, test the special characters * and ?

$ ls f?.txt
$ ls file??.txt
$ ls file???.txt
$ ls ??.txt

$ ls file*.txt
$ ls f*.txt

You should now have some understanding about the difference between * and ?. Next, remove the extra files you created for this exercise:

$ rm file01.txt
$ rm file02.txt

Have the two files been removed?

$ ls

Do you have to remove files one by one?

$ rm file*.txt

Has this one command line removed multiple files?

$ ls

Next, do more exercises on manipulating files.
Under the current directory make a new sub-directory named testdir:

$ mkdir testdir

Copy f1.txt and f2.txt into the new sub-directory:
$ cp f1.txt f2.txt testdir

Can you check to see whether a copy of the two files are actually in testdir?

$ cd testdir
$ ls
What is your current directory now?

$ pwd

Can you go back to the parent directory (kit501) of the current directory?

$ cd ..

Are you really under kit501 now?

$ pwd

How can you delete testdir together with its content?

$ rmdir testdir

Looks like this cannot be done, because rmdir deletes only empty directories. You can change directory into testdir, remove the two files manually to make it an empty directory, and then come back here to run rmdir. However, there is a better approach for this purpose.

$ rm -r testdir
Has the testdir (which is non-empty) been removed?

$ ls

(Warning: rm with option -r can be a dangerous operation because it deletes an entire directory tree.)

Next, try the option -r with the cp command
Make two test directories named testdir1 and testdir2:

$ mkdir testdir1 testdir2
$ ls

Copy f1.txt and f2.txt into testdir1:

$ cp f1.txt f2.txt testdir1
$ ls testdir1

More Hands-on Exercises

A). Under the directory kit501 create two subdirectories called testdir1 and testdir2 using a single command line. Use ls to check their existence.

B). Under testdir1 create two subdirectories named d1 and d2 using a single command line.

C). Under d1 create two ordinary files named file1.txt and file2.txt using the joe or nano text editor.

D). Copy all files in the directory d1 to the directory d2 using a single command line.

E). Under the directory d2 rename file1.txt as f1.txt and file2.txt as f2.txt.

F). Under the directory d2 move f1.txt and f2.txt to the directory d1 using a single command line.

G). Remove the directory d2.

H). Copy everything (files, directories) under the directory testdir1 to the directory testdir2 using a single command line.

I). Remove the directory testdir1.

J) Run the following command and ensure that you understand the output:

$ du -a testdir2

K). Remove the directory testdir2 without first making it empty.

L). Create 5 new directories (under kit501) which must be named dir1, dir2, dir3, dir4, and dir5.

Create a text file under dir1 and a text file under dir2.

Then under the parent directory (kit501) of the 5 directories, remove all the empty directories but retain all the nonempty directories using a single short command line (a command with a single argument).

Attachment:- Practical.rar

Reference no: EM133140271

Questions Cloud

Evaluate the bitwise logical operations : Evaluate the bitwise logical operations - Convert the 8-bit 2s complement numbers to their decimal equivalent
Prepare the entries on the dates listed : Maker paid $12,000 to purchase a call option to buy 1 million FCU at a strike price of $0.255 expiring end of year. Prepare the entries on the dates listed
Who got the highest cash distribution : A, B, G and J are partners with capitals of P11,000; P10,300; P13,700 and P9,000 respectively. Who got the highest cash distribution
How much revenue would be allocated to the tv : The entire package points sells for $2,600. How much revenue would be allocated to the TV, the remote, and the installation service
General-purpose UNIX commands : Create two subdirectories called testdir1 and testdir2 using a single command line. Use ls to check their existence
Business intelligence : What are the common business problems addressed by Big Data analytics? In the era of Big Data, are we about to witness the end of data warehousing? Why?
Primary business benefits of e-commerce operation : What do you think are the three primary business benefits of an e-commerce operation for a retail organization interacting with its customers?
Data analysis findings and highlights limitations : you must provide a narrative that discusses the key insights from your data analysis findings and highlights the limitations of your analysis.
Communication differ in person versus electronic : How does communication differ in person versus electronic communication?

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd