0% found this document useful (0 votes)
16 views5 pages

Lab 1

Uploaded by

Maaz Sayyed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views5 pages

Lab 1

Uploaded by

Maaz Sayyed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment Number: 1

Problem Statement: Basic Linux Commands


NAME: Sayyed Md Muaz Aslam ROLLNO: 60
CLASS: TY_IT_A BATCH: B3
DATE OF PERFORMANCE: 06-07-2023
___________________________________________________________________________
1. cp : Copy from the to the
2. mv : Move/rename the to the
3. rm :Remove the file named
4. mkdir :Make a new directory called
5. rmdir :Remove an (empty) directory
6. cd :Change the current working directory to dir
7. pwd : Print (display) the working directory
8. cat > :To create new file n save it by pressing ^d
9. cat >> : To append contents into file
10. cat :To see the contents of existing file
11. more :Paging out the contents of file
12. file :To check the type of file
13. wc :To count lines,words,charaters of file
14. cmp :To compare two files
15. comm :To display common values between two files
16. diff :To convert one file to another
17. gzip :To compress the file
18. gunzip :To unzip the contents of zipped file
19. ls :List the files in the current working directory
20. ls :List all files & directories in given directory
21. ln : Creates a symbolic link to a file
22. date: To display current date & time of the system.
23. cal :To display calendar of current month.
24. who:List who is currently logged on to the system.
25. Whoami:Report what user you are logged on as.
26. echo :Echo a string (or list of arguments) to the terminal
27. bc:To perform mathematical operations
28. clear:To clear the screen

Commands:
maaz05@DESKTOP-KRA5MTK:~$ ls
maaz05@DESKTOP-KRA5MTK:~$ pwd
/home/maaz05
maaz05@DESKTOP-KRA5MTK:~$ date
Fri Jul 14 21:58:56 IST 2023
maaz05@DESKTOP-KRA5MTK:~$ cal
Command 'cal' not found, but can be installed with:
sudo apt install ncal
maaz05@DESKTOP-KRA5MTK:~$ whp
Command 'whp' not found, did you mean:
command 'php' from deb php8.1-cli (8.1.2-1ubuntu2.11)
command 'php' from deb php-cli (2:8.1+92ubuntu1)
command 'who' from deb coreutils (8.32-4.1ubuntu1)
Try: sudo apt install <deb name>
maaz05@DESKTOP-KRA5MTK:~$ who
maaz05@DESKTOP-KRA5MTK:~$ touch f1.txt
maaz05@DESKTOP-KRA5MTK:~$ echo "This is file 1">> f1.txt
maaz05@DESKTOP-KRA5MTK:~$ ls
f1.txt
maaz05@DESKTOP-KRA5MTK:~$ touch f2.txt
maaz05@DESKTOP-KRA5MTK:~$ echo "This is file2">> f2.txt
maaz05@DESKTOP-KRA5MTK:~$ ls
f1.txt f2.txt
maaz05@DESKTOP-KRA5MTK:~$ touch f3.txt
maaz05@DESKTOP-KRA5MTK:~$ echo "This is echo command of linux" >>f3.txt
maaz05@DESKTOP-KRA5MTK:~$ ls
f1.txt f2.txt f3.txt
maaz05@DESKTOP-KRA5MTK:~$ cp <f1.txt><f2.txt>
-bash: syntax error near unexpected token `<'
maaz05@DESKTOP-KRA5MTK:~$ cp f1.txt f2.txt
maaz05@DESKTOP-KRA5MTK:~$ f1.txt
f1.txt: command not found
maaz05@DESKTOP-KRA5MTK:~$ cat f1.txt
This is file 1
maaz05@DESKTOP-KRA5MTK:~$ cat f2.txt
This is file 1
maaz05@DESKTOP-KRA5MTK:~$ mkdir /home/maaz05/folders
maaz05@DESKTOP-KRA5MTK:~$ cd /home/maaz05/folders
maaz05@DESKTOP-KRA5MTK:~/folders$ touch f2_renamed.txt
maaz05@DESKTOP-KRA5MTK:~/folders$ cd /home/maaz05
maaz05@DESKTOP-KRA5MTK:~$ mv f2.txt /home/maaz05/folders/f2_renamed.txt
maaz05@DESKTOP-KRA5MTK:~$ cd /home/maaz05/folders
maaz05@DESKTOP-KRA5MTK:~/folders$ cat f2_renamed.txt
This is file 1
maaz05@DESKTOP-KRA5MTK:~/folders$ cat >> f2_renamed.txt
"This file is renamed and it is appended"
maaz05@DESKTOP-KRA5MTK:~/folders$ cat f2_renamed.txt
This is file 1
"This file is renamed and it is appended"
maaz05@DESKTOP-KRA5MTK:~/folders$ more f2_renamed.txt
This is file 1
"This file is renamed and it is appended"
maaz05@DESKTOP-KRA5MTK:~/folders$ cd /home/maaz05
maaz05@DESKTOP-KRA5MTK:~$ file f3.txt
f3.txt: ASCII text
maaz05@DESKTOP-KRA5MTK:~$ wc f3.txt
1 6 30 f3.txt
maaz05@DESKTOP-KRA5MTK:~$ cmp f2.txt f3.txt
cmp: f2.txt: No such file or directory
maaz05@DESKTOP-KRA5MTK:~$ cmp f1.txt f3.txt
f1.txt f3.txt differ: byte 9, line 1
maaz05@DESKTOP-KRA5MTK:~$ comm f1.txt f3.txt
This is echo command of linux
This is file 1
maaz05@DESKTOP-KRA5MTK:~$ diff f1.txt f3.txt
1c1
< This is file 1
---
> This is echo command of linux
maaz05@DESKTOP-KRA5MTK:~$ ln f1.txt link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ ls
f1.txt f3.txt folders link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ cat -A f1.txt
This is file 1$
maaz05@DESKTOP-KRA5MTK:~$ cat -v f3.txt
This is echo command of linux
maaz05@DESKTOP-KRA5MTK:~$ cat -n f1.txt
1 This is file 1
maaz05@DESKTOP-KRA5MTK:~$ cat > f4.txt
This is file 4 using cat command
maaz05@DESKTOP-KRA5MTK:~$ cat f4.txt
This is file 4 using cat command
maaz05@DESKTOP-KRA5MTK:~$ ls -l
total 0
-rw-r--r-- 2 maaz05 maaz05 15 Jul 14 22:01 f1.txt
-rw-r--r-- 1 maaz05 maaz05 30 Jul 14 22:03 f3.txt
-rw-r--r-- 1 maaz05 maaz05 33 Jul 14 22:20 f4.txt
drwxr-xr-x 1 maaz05 maaz05 512 Jul 14 22:10 folders
-rw-r--r-- 2 maaz05 maaz05 15 Jul 14 22:01 link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ ls -lh
total 0
-rw-r--r-- 2 maaz05 maaz05 15 Jul 14 22:01 f1.txt
-rw-r--r-- 1 maaz05 maaz05 30 Jul 14 22:03 f3.txt
-rw-r--r-- 1 maaz05 maaz05 33 Jul 14 22:20 f4.txt
drwxr-xr-x 1 maaz05 maaz05 512 Jul 14 22:10 folders
-rw-r--r-- 2 maaz05 maaz05 15 Jul 14 22:01 link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ ls -a
. .. .bash_history .bash_logout .bashrc .motd_shown .profile f1.txt f3.txt f4.txt
folders link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ ls-lt
ls-lt: command not found
maaz05@DESKTOP-KRA5MTK:~$ ls -lt
total 0
-rw-r--r-- 1 maaz05 maaz05 33 Jul 14 22:20 f4.txt
drwxr-xr-x 1 maaz05 maaz05 512 Jul 14 22:10 folders
-rw-r--r-- 1 maaz05 maaz05 30 Jul 14 22:03 f3.txt
-rw-r--r-- 2 maaz05 maaz05 15 Jul 14 22:01 f1.txt
-rw-r--r-- 2 maaz05 maaz05 15 Jul 14 22:01 link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ ls -r
link_to_f1.txt folders f4.txt f3.txt f1.txt
maaz05@DESKTOP-KRA5MTK:~$ ls
f1.txt f3.txt f4.txt folders link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ zip archive.zip f1.txt f4.txt
Command 'zip' not found, but can be installed with:
sudo apt install zip
maaz05@DESKTOP-KRA5MTK:~$ sudo apt install zip
[sudo] password for maaz05:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
unzip
The following NEW packages will be installed:
unzip zip
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 350 kB of archives.
After this operation, 929 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 unzip amd64 6.0-
26ubuntu3.1 [174 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 zip amd64 3.0-12build2
[176 kB]
Fetched 350 kB in 3s (114 kB/s)
Selecting previously unselected package unzip.
(Reading database ... 24137 files and directories currently installed.)
Preparing to unpack .../unzip_6.0-26ubuntu3.1_amd64.deb ...
Unpacking unzip (6.0-26ubuntu3.1) ...
Selecting previously unselected package zip.
Preparing to unpack .../zip_3.0-12build2_amd64.deb ...
Unpacking zip (3.0-12build2) ...
Setting up unzip (6.0-26ubuntu3.1) ...
Setting up zip (3.0-12build2) ...
Processing triggers for man-db (2.10.2-1) ...
maaz05@DESKTOP-KRA5MTK:~$ zip archive.txt f1.txt f4.txt
adding: f1.txt (stored 0%)
adding: f4.txt (stored 0%)
maaz05@DESKTOP-KRA5MTK:~$ ls
archive.txt f1.txt f3.txt f4.txt folders link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ zip archive.zip f1.txt f4.txt
adding: f1.txt (stored 0%)
adding: f4.txt (stored 0%)
maaz05@DESKTOP-KRA5MTK:~$ ls
archive.txt archive.zip f1.txt f3.txt f4.txt folders link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ unzip archive.txt
Archive: archive.txt
replace f1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: unzip archive.zip
error: invalid response [unzip arc]
replace f1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: error: invalid response [hive.zip]
replace f1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename:
error: invalid response [{ENTER}]
replace f1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: n
replace f4.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: n
maaz05@DESKTOP-KRA5MTK:~$ cal
Command 'cal' not found, but can be installed with:
sudo apt install ncal
maaz05@DESKTOP-KRA5MTK:~$ mkdir /home/maaz05/dir/
maaz05@DESKTOP-KRA5MTK:~$ ls
archive.txt archive.zip dir f1.txt f3.txt f4.txt folders link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ rmdir /home/maaz05/dir/
maaz05@DESKTOP-KRA5MTK:~$ ls
archive.txt archive.zip f1.txt f3.txt f4.txt folders link_to_f1.txt
maaz05@DESKTOP-KRA5MTK:~$ sudo apt install cal
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package cal
maaz05@DESKTOP-KRA5MTK:~$ clear
maaz05@DESKTOP-KRA5MTK:~$

You might also like