Professional Documents
Culture Documents
Exercise 3
Dela Cruz, Clarisse T. Eullaran, Czra Harvey C.
Manansala, Janna C. BSIT – 2A
clarisse@clarisse-VirtualBox:~$clear
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
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.
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.
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.
This sample.text files are not existing that’s why we create a new file using “vi”.
clarisse@clarisse-VirtualBox:~$ vi sample.text
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
clarisse@clarisse-VirtualBox:~/$ cd ..
clarisse@clarisse-VirtualBox:~/$ cd usr
clarisse@clarisse-VirtualBox:~/usr$ ls -l
Platform Technologies
Exercise 3
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
clarisse@clarisse-VirtualBox:~$ cd dir1
clarisse@clarisse-VirtualBox:~/dir1$ mkdir dir1_1
clarisse@clarisse-VirtualBox:~/dir1$ mkdir dir1_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
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
clarisse@clarisse-VirtualBox:~$ cd dir2
clarisse@clarisse-VirtualBox:~/dir2$ rmdir dir2_2
clarisse@clarisse-VirtualBox:~/dir2$ ls
dir2_1
Platform Technologies
Exercise 3
clarisse@clarisse-VirtualBox:~/dir2$ cd ..
clarisse@clarisse-VirtualBox:~$ cd dir3
clarisse@clarisse-VirtualBox:~/dir3$ rmdir dir3_2
clarisse@clarisse-VirtualBox:~/dir3$ ls
dir3_1
clarisse@clarisse-VirtualBox:~$ vi file_original.txt
clarisse@clarisse-VirtualBox:~$ ls
Platform Technologies
Exercise 3
clarisse@clarisse-VirtualBox:~$ cp file_original.txt
dir1/file1.txt
clarisse@clarisse-VirtualBox:~$ cd dir1
clarisse@clarisse-VirtualBox:~/dir1$ ls -l
clarisse@clarisse-VirtualBox:~$ cp file_original.txt
dir2/file2.txt
clarisse@clarisse-VirtualBox:~$ cd dir2
clarisse@clarisse-VirtualBox:~/dir2$ ls -l
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