Oslab
Oslab
AIM:
To study and execute the basic LINUX commands in Ubuntu Operating System
ALGORITHM:
1. Open terminal from ubuntu dock or use the keyboard shortcut ctrl + alt + T to open terminal.
2. For opening calendar in ubuntu , type cal in terminal
3. If cal is not installed then install calendar by using the command sudo apt install ncal
4. Now type date in terminal to view date , the date command will also display time
5. Now type clear command , this command clears the terminal screen
6. Now the terminal screen is cleared , now use change directories command cd to enter into
particular folder/directory
7.Now type ls -a , this command displays all files in the directory, including hidden files that start
with a dot (.)
8.Now type ls -c, this command displays the output in a multi-column format, which is useful when
you have many files in a directory.
9.Now type ls -d , this command lists directory names instead of their contents.
10. Now type ls -m , this command list files separated by commas,which is useful for parsing or
when you need a compact view.
11.Now type ls -p , this command adds a forward slash (/) to directory names, making it easy to
distinguish directories from regular files.
12.Now type ls -r , this command reverses the order of the sort , -r will sort in reverse alphabetical
order.
13.Now type ls -f, this command Lists files in the order they appear in the directory and it also
disables sorting and formatting
14.Now type ls -x , this command lists entries by lines instead of by columns.
15.Now create a new text file using text editor while saving the file use .txt extension
16.Now type wc -l , this command counts and displays the number of lines in the specified file.
17.Now type wc -w , this command counts and displays the number of words in the specified file.
18.Now type wc -c , this command counts and displays the number of bytes in the specified file.
19.Now type wc -m , this command counts and displays the number of characters in the specified
file.
20.Now type wc -L , this command finds and displays the length of the longest line in the specified
file.
21.Now create another text file in the directory , now use the command copy files $ cp file 1 file 2.
Here file 1 is the source file and file 2 is the destination file.
22.Now Type vi filename in the terminal. If the file doesn't exist, it will be created.To save and
quit, type: :wq and press enter