You are on page 1of 15

Platform Technologies

Exercise 3
Dela Cruz, Clarisse T. Eullaran, Czra Harvey C.
Manansala, Janna C. BSIT – 2A

1. LINUX COMMAND FORMAT

clear is a standard Unix computer operating system command that is used to


clear the terminal screen.

clarisse@clarisse-VirtualBox:~$clear

2. THE Is (List) COMMAND


Platform Technologies
Exercise 3

It's used to display information about the file system's files and directories. All
Linux distributions include the GNU core utilities package, which includes the ls
utility.

clarisse@clarisse-VirtualBox:~$ls -l

This command it display all hidden files in the current directory you in. To
identify the hidden files, it is start in “dot” or “.”.

clarisse@clarisse-VirtualBox:~$ls -a
Platform Technologies
Exercise 3
The ls command can also have an argument in my example we use Pictures
and DOCUMENTS to display the content of Pictures directory and DOCUMENTS.

clarisse@clarisse-VirtualBox:~$ls Pictures
clarisse@clarisse-VirtualBox:~$ls DOCUMENTS

3. COMMAND USAGE PRINCIPLES

This command is for multiple option. The separation rule is applied in this case to have
a space if you have multiple options, we used separation to execute the command
properly this command ls -a -l display the long listing of all the files.

clarisse@clarisse-VirtualBox:~$ls -a -l
Platform Technologies
Exercise 3
This command is the same output or display in ls -a -l. But the syntax is not the same
in the ls -a -l we used a space to every operation to execute the command but in
this command, we did not put a space between a and l because the user can be
combined multiple options in a single dash.

clarisse@clarisse-VirtualBox:~$ls -al

In the multiple command the user may enter several commands. Using
semicolon delimits each command you enter. After executing the command,
the output display all the list or files and directory, all hidden files, and the long
listing of files and directories that includes the information.

clarisse@clarisse-VirtualBox:~$ls; ls -a; ls -l
Platform Technologies
Exercise 3
For multiple arguments you can enter more arguments in one command. The
separation rules are applicable in multiple arguments to separate the
arguments you want to enter. In our example we use arguments: Desktop
directory and Pictures folder. The output displays the long listing of the files and
directories includes the information.

clarisse@clarisse-VirtualBox:~$ls -l Desktop Pictures

4. THE man (MANUAL) COMMAND

The man command it display the different commands in Linux. We try the
command man ls then after the man pages will display. We use the moving
keys to move the man pages: (Spacebar – next screen of man page, Return –
the next line, b – to scroll back, f – to scroll forward, q – to exit the man page,
/pattern – for searches forward pattern, n- find the next occurrence and h –
display help menu)

clarisse@clarisse-VirtualBox:~$ man ls
Platform Technologies
Exercise 3

date command is used to display the system date and time. date command is also
used to set date and time of the system. By default, the date command displays the
date in the time zone on which Linux operating system is configured. You must be the
superuser (root) to change the date and time. The date command has a several
options that you can use.

clarisse@clarisse-VirtualBox:~$ man date

The cal command is a command line utility for displaying a calendar in the terminal.
It can be used to print a single month, many months or an entire year. It supports
starting the week on a Monday or a Sunday, showing dates and showing calendars
for arbitrary dates passed as arguments. The cal command has a several options that
you can use.

clarisse@clarisse-VirtualBox:~$ man cal


Platform Technologies
Exercise 3
5. THE vi TEXT EDITOR OF UNIX

This sample.text files are not existing that’s why we create a new file using “vi”.

clarisse@clarisse-VirtualBox:~$ vi sample.text

II. Linux Files and Directories

1. LINUX FILE AND DIRECTORY NAMING CONVENTIONS

2. LINUX FILE SYSTEM

3. PATHS

4. FILE/DIRECTORIES COMMAND

We use the pwd command then the current directory is /home/aldrin. The pwd
command determine what directory you currently in.

clarisse@clarisse-VirtualBox:~$ pwd
Platform Technologies
Exercise 3

In this output we use cd / to go to the root directory. After we enter the command,
the current directory now is root directory. In the root directory we used command ls
-l to list the directories under of root directory.

clarisse@clarisse-VirtualBox:~$ cd /
clarisse@clarisse-VirtualBox:/$ ls -l

In this output we try the cd .. command to go back the directories or to change


directory. After we user cd .. I used again the cd to go to directory games then
after we enter, the current directory now is directory games then we used the
command ls -l to list the files that have in directory games. In our observation
cd .. command is the same in dos command prompt to change directory you
are in. but in executing the commands, in command prompt command cd..
has no space then in Linux command cd .. have a space.

clarisse@clarisse-VirtualBox:~/$ cd ..
clarisse@clarisse-VirtualBox:~/$ cd usr
clarisse@clarisse-VirtualBox:~/usr$ ls -l
Platform Technologies
Exercise 3

In this output we try the cd .. command to go back the directories or to change


directory. After we user cd .. I used again the cd to go to directory bin then
after we enter, the current directory now is directory bin then we used the
command ls -l to list the files that have in directory bin. In our observation cd ..
command is the same in dos command prompt to change directory you are
in. but in executing the commands, in command prompt command cd.. has
no space then in Linux command cd .. have a space.

clarisse@clarisse-VirtualBox:~/usr$ cd bin
clarisse@clarisse-VirtualBox:~/usr$ ls -l

In this output after we try the cd command and go to other directory, we used
cd command to go back in home directory. And to sure that we are in home
directory we used pwd command to see the current directory we in.

clarisse@clarisse-VirtualBox:~/usr/bin$ cd ..
clarisse@clarisse-VirtualBox:~/usr$ cd
clarisse@clarisse-VirtualBox:~$ pwd
/home/clarisse
Platform Technologies
Exercise 3

In this output we create a 3 subdirectories dir1, dir2, and dir3 using mkdir
command in current directory that we in.

clarisse@clarisse-VirtualBox:~$ pwd
/home/clarisse
clarisse@clarisse-VirtualBox:~$ mkdir dir1
clarisse@clarisse-VirtualBox:~$ mkdir dir2
clarisse@clarisse-VirtualBox:~$ mkdir dir3

In this output we use cd to go in dir1 subdirectory. After we in to the dir1


subdirectory we create two subdirectories (dir1_1 and dir1_2).

clarisse@clarisse-VirtualBox:~$ cd dir1
clarisse@clarisse-VirtualBox:~/dir1$ mkdir dir1_1
clarisse@clarisse-VirtualBox:~/dir1$ mkdir dir1_2

In this output we used cd .. to go back the directory then we change the


subdirectory in dir2. In dir2 subdirectory we create two subdirectories (dir2_1
and dir2_2).

clarisse@clarisse-VirtualBox:~/dir1$ cd ..
clarisse@clarisse-VirtualBox:~$ cd dir2
clarisse@clarisse-VirtualBox:~/dir2$ mkdir dir2_1
clarisse@clarisse-VirtualBox:~/dir2$ mkdir dir2_2
Platform Technologies
Exercise 3

In this output we used cd .. to go back the directory then we change the


subdirectory in dir3. In dir3 subdirectory we create two subdirectories (dir3_1
and dir3_2). Then after creating subdirectories. We use the cd command to go
back to the home directory. And the pwd to display if we are in in the home
directory.

clarisse@clarisse-VirtualBox:~/dir2$ cd ..
clarisse@clarisse-VirtualBox:~$ cd dir3
clarisse@clarisse-VirtualBox:~/dir3$ mkdir dir3_1
clarisse@clarisse-VirtualBox:~/dir3$ mkdir dir3_2
clarisse@clarisse-VirtualBox:~/dir3$ cd
clarisse@clarisse-VirtualBox:~$ pwd
/home/Clarisse

In this output we change the subdirectory in to dir2. Then after we in to the


subdirectory dir2 we remove the dir2_2 using rmdir command. To sure if the
dir2_2 is removed we used the ls command to display the content of dir2
subdirectory.

clarisse@clarisse-VirtualBox:~$ cd dir2
clarisse@clarisse-VirtualBox:~/dir2$ rmdir dir2_2
clarisse@clarisse-VirtualBox:~/dir2$ ls
dir2_1
Platform Technologies
Exercise 3

In this output we used cd .. command to go back the directory, then we call


the dir3 subdirectory. After we in in dir3 subdirectory we remove the dir3_2
subdirectory using rmdir command. To sure that the dir3_2 is removed we used
ls command to display the content of dir3 subdirectory.

clarisse@clarisse-VirtualBox:~/dir2$ cd ..
clarisse@clarisse-VirtualBox:~$ cd dir3
clarisse@clarisse-VirtualBox:~/dir3$ rmdir dir3_2
clarisse@clarisse-VirtualBox:~/dir3$ ls
dir3_1

In this output we create a .txt file, file_original.txt using vi command in home


directory. And type a message in the document that we create.

clarisse@clarisse-VirtualBox:~$ vi file_original.txt
clarisse@clarisse-VirtualBox:~$ ls
Platform Technologies
Exercise 3

In this output we used the cp command to copy the file_orinal.txt in to dir1


subdirectory then rename or change the file name into file1.txt. To sure that
the files is copy and change the file name. We used cd dir1 command then ls
-l command to list the files or subdirectories that have in dir1 subdirectories.

clarisse@clarisse-VirtualBox:~$ cp file_original.txt
dir1/file1.txt
clarisse@clarisse-VirtualBox:~$ cd dir1
clarisse@clarisse-VirtualBox:~/dir1$ ls -l

In this output we used the cp command to copy the file_orinal.txt in to dir2


subdirectory then rename or change the file name into file2.txt. To sure that
the files is copy and change the file name. We used cd dir2 command then ls
-l command to list the files or subdirectories that have in dir2 subdirectories.

clarisse@clarisse-VirtualBox:~$ cp file_original.txt
dir2/file2.txt
clarisse@clarisse-VirtualBox:~$ cd dir2
clarisse@clarisse-VirtualBox:~/dir2$ ls -l

In this output we used the cp command to copy the file_orinal.txt in to dir3


subdirectory then rename or change the file name into file3.txt. To sure that
the files is copy and change the file name. We used cd dir3 command then ls
-l command to list the files or subdirectories that have in dir3 subdirectories.
Platform Technologies
Exercise 3
clarisse@clarisse-VirtualBox:~$ cp file_original.txt
dir3/file3.txt
clarisse@clarisse-VirtualBox:~$ cd dir3
clarisse@clarisse-VirtualBox:~/dir3$ ls -l

In this output we change the file name of File_Original.txt to Original_File.txt. to


sure that the file name is change we used ls-l command to display.

clarisse@clarisse-VirtualBox:~$ mv file_original
Original_File.txt
clarisse@clarisse-VirtualBox:~$ ls -l

In this output we move the file1.txt to dir1_1 and change the file name into
file1_1.txt. To sure that the files is move to the dir1_1 we used cd dir1_1
command then to ls -l command or display the file in dir1_1 subdirectory.
Platform Technologies
Exercise 3
clarisse@clarisse-VirtualBox:~$ cd dir1
clarisse@clarisse-VirtualBox:~/dir1$ mv file1.txt
dir1_1/file_1.txt
clarisse@clarisse-VirtualBox:~/dir1$ cd dir1_1
clarisse@clarisse-VirtualBox:~/dir1/dir1_1$ ls -l

In this output we move the file1.txt to dir2_1 and change the file name into
file2_1.txt. To sure that the files is move to the dir2_1 we used cd dir1_1
command then to ls -l command or display the file in dir2_1 subdirectory.

clarisse@clarisse-VirtualBox:~/dir2$ mv file2.txt
dir2_1/file2_1.txt
clarisse@clarisse-VirtualBox:~/dir2$ cd dir2_1
clarisse@clarisse-VirtualBox:~/dir2/dir2_1$ ls -l

In this output we remove the file3.txt in subdirectory dir3. To sure that the file is
deleted we go to subdirectory dir3 we used cd dir3, and then after we in, we
used ls command to list or display the file or directory in dir3 subdirectory.

clarisse@clarisse-VirtualBox:~$ rm dir3/file3.txt
clarisse@clarisse-VirtualBox:~$ cd dir3
clarisse@clarisse-VirtualBox:~/dir3$ ls

You might also like