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

Linux Report

The document describes various Linux commands and their usage for directory navigation, file manipulation, and system queries. It covers commands for changing directories (cd), listing files (ls), creating/removing directories and files (mkdir, touch, rm, rmdir), editing files (nano, cat), copying files (cp), printing system information (uname), and more. Interactive options are demonstrated for removing files and directories safely.

Uploaded by

remama2191
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 views9 pages

Linux Report

The document describes various Linux commands and their usage for directory navigation, file manipulation, and system queries. It covers commands for changing directories (cd), listing files (ls), creating/removing directories and files (mkdir, touch, rm, rmdir), editing files (nano, cat), copying files (cp), printing system information (uname), and more. Interactive options are demonstrated for removing files and directories safely.

Uploaded by

remama2191
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/ 9

Date: 11.01.

24

1. ‘pwd’-prints working directory

INPUT:-
sdb@bond007:~$ pwd

OUTPUT:-
/home/sdb

2. ‘ls’- lists all the types of files in the active directory


INPUT:-
sdb@bond007:~$ ls

OUTPUT:-
Desktop Downloads Pictures snap Videos
Documents Music Public Templates

3. ‘ls -l’- lists all the types of files in the active directory with much more
information

INPUT:-
sdb@bond007:~$ ls -l

OUTPUT:-
total 36
drwxr-xr-x 3 sdb sdb 4096 Jan 16 00:34 Desktop
drwxr-xr-x 2 sdb sdb 4096 Jan 16 00:14 Documents
drwxr-xr-x 2 sdb sdb 4096 Jan 16 00:14 Downloads
drwxr-xr-x 2 sdb sdb 4096 Jan 16 00:14 Music
drwxr-xr-x 2 sdb sdb 4096 Jan 16 00:14 Pictures
drwxr-xr-x 2 sdb sdb 4096 Jan 16 00:14 Public
drwx------ 4 sdb sdb 4096 Jan 16 22:12 snap
drwxr-xr-x 2 sdb sdb 4096 Jan 16 00:14 Templates
drwxr-xr-x 2 sdb sdb 4096 Jan 16 00:14 Videos

4. ‘cd’- changing of active directory

INPUT:- (changing the active directory to Documents)


sdb@bond007:~$ cd Documents/

OUTPUT:-
sdb@bond007:~/Documents$
5. ‘mkdir’-making of new directory

INPUT:- making of new directory named soham


sdb@bond007:~/Documents$ mkdir soham

OUTPUT:-
sdb@bond007:~/Documents$ ls
soham

6. ‘cd ..’- changes to parent directory

INPUT:-
sdb@bond007:~/Documents$ cd ..

OUTPUT:-
sdb@bond007:~$

7. ‘cd ~’- changes to home directory of the currently logged in user

INPUT:-
sdb@bond007:~/Documents/soham$ cd ~

OUTPUT:-
sdb@bond007:~$

8. ‘cd /’-changes to root directory ‘ls -a’- shows hidden files in the active directory

INPUT:-
sdb@bond007:~$ cd /

OUTPUT:-
sdb@bond007:/$

9. ‘ls -a’- shows hidden files in the active directory

INPUT:-
sdb@bond007:/$ ls-a

OUTPUT:-
. bin cdrom etc lib media opt root sbin srv sys usr
.. boot dev home lost+found mnt proc run snap swapfile tmp var
10. ‘ls -la’- shows hidden files in the active directory with much more information

INPUT:-
sdb@bond007:/$ ls-la

OUTPUT:-
total 1648728
drwxr-xr-x 20 root root 4096 Jan 16 00:06 .
drwxr-xr-x 20 root root 4096 Jan 16 00:06 ..
lrwxrwxrwx 1 root root 7 Jan 16 00:05 bin -> usr/bin
drwxr-xr-x 4 root root 4096 Jan 16 00:08 boot
drwxr-xr-x 2 root root 4096 Jan 16 00:06 cdrom
drwxr-xr-x 19 root root 4000 Jan 18 00:47 dev
drwxr-xr-x 126 root root 12288 Jan 16 00:18 etc
drwxr-xr-x 3 root root 4096 Jan 16 00:07 home
lrwxrwxrwx 1 root root 7 Jan 16 00:05 lib -> usr/lib
drwx------ 2 root root 16384 Jan 16 00:04 lost+found
drwxr-xr-x 2 root root 4096 Jan 15 13:25 media
drwxr-xr-x 2 root root 4096 Jan 15 13:25 mnt
drwxr-xr-x 2 root root 4096 Jan 15 13:25 opt
dr-xr-xr-x 239 root root 0 Jan 18 00:47 proc
drwx------ 4 root root 4096 Jan 16 00:14 root
drwxr-xr-x 35 root root 920 Jan 18 01:17 run
lrwxrwxrwx 1 root root 8 Jan 16 00:05 sbin -> usr/sbin
drwxr-xr-x 11 root root 4096 Jan 15 13:35 snap
drwxr-xr-x 2 root root 4096 Jan 15 13:25 srv
-rw------- 1 root root 1688207360 Jan 16 00:04 swapfile
dr-xr-xr-x 13 root root 0 Jan 18 00:47 sys
drwxrwxrwt 19 root root 4096 Jan 18 01:17 tmp
drwxr-xr-x 11 root root 4096 Jan 15 13:25 usr
drwxr-xr-x 14 root root 4096 Jan 15 13:33 var
Date: 18.01.24

11. ‘ls -lh’- displays all files in the active directory with human readable storage
information

INPUT:-
sdb@bond007:~$ ls -lh

OUTPUT:-
total 44K
drwxr-xr-x 2 sdb sdb 4.0K Jan 24 21:18 Desktop
drwxr-xr-x 5 sdb sdb 4.0K Jan 18 14:27 Documents
drwxr-xr-x 2 sdb sdb 4.0K Jan 16 00:14 Downloads
drwxrwxr-x 4 sdb sdb 4.0K Jan 18 16:04 MIC
drwxr-xr-x 2 sdb sdb 4.0K Jan 16 00:14 Music
drwxr-xr-x 2 sdb sdb 4.0K Jan 16 00:14 Pictures
drwxr-xr-x 2 sdb sdb 4.0K Jan 16 00:14 Public
drwx------ 4 sdb sdb 4.0K Jan 16 22:12 snap
drwxrwxr-x 2 sdb sdb 4.0K Jan 18 14:26 temp
drwxr-xr-x 2 sdb sdb 4.0K Jan 16 00:14 Templates
drwxr-xr-x 2 sdb sdb 4.0K Jan 16 00:14 Videos

12.‘touch’- creating a file

INPUT:-
sdb@bond007:~/MIC$ touch file1

OUTPUT:- (Using ls to see the created file)

sdb@bond007:~/MIC$ ls
file1

13.‘nano’- editing a file in nano text editor


14. ‘cat’- display the contents of the file

INPUT:-
sdb@bond007:~/MIC$ nano file1
sdb@bond007:~/MIC$ cat file1

OUTPUT:-
a
b
c
d

15. ‘cat file1 file2’- display the contents of the files in a series
INPUT:- (creating another file named as file2 and using nano editor to edit the file)

sdb@bond007:~/MIC$ nano file2


sdb@bond007:~/MIC$ cat file1 file2

OUTPUT:-
a
b
c
d
1
2
3
4

16. ‘cat >’- copies the contents of the files in a new file

INPUT:-
sdb@bond007:~/MIC$ cat file1 file2 > file3
sdb@bond007:~/MIC$ cat file3

OUTPUT:-
a
b
c
d
1
2
3
4

17. ‘cat -n’- display the contents of the file with line numbers

INPUT:-
sdb@bond007:~/MIC$ cat -n file3

OUTPUT:-
1 a
2 b
3 c
4 d
5 1
6 2
7 3
8 4
18. ‘cat >>’- appends the file information of one file to another i.e. it concatenates
the information of one file to another

INPUT:-
sdb@bond007:~/MIC$ cat file1 >>file2
sdb@bond007:~/MIC$ cat file2

OUTPUT:-
1
2
3
a
b
c
d

19. ‘echo’- prints the statement given in the terminal as an output

INPUT:-
sdb@bond007:~/MIC$ echo "Hello World"

OUTPUT:-
Hello World

20. ‘$ name’- saves the value of the string “Hello World” to the variable ‘name’

INPUT:-
sdb@bond007:~/MIC$ name="SDB"
sdb@bond007:~/MIC$ echo "Hello $name"

OUTPUT:-
Hello SDB

21. ‘echo -e’- prints the string in new lines

INPUT:-
sdb@bond007:~/MIC$ echo -e "1\n2\n3"

OUTPUT:-
1
2
3

22. ‘uname -a’- prints version of linux OS


INPUT:-
sdb@bond007:~/MIC$ uname -a

OUTPUT:-
Linux bond007 6.5.0-14-generic #14~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 20
20:26:31 UTC 2 aarch64 aarch64 aarch64 GNU/Linux

23. ‘rmdir’- removes empty directories

INPUT:-
sdb@bond007:~/MIC$ rmdir MIC/
sdb@bond007:~/MIC$ ls

OUTPUT:-
file1 file11 file2 file3 greetings.txt MBT
23. ‘rm -r’- used to remove both empty and non-empty directories and files also

INPUT:-
sdb@bond007:~/MIC$ rm -r MBT/
sdb@bond007:~/MIC$ ls

OUTPUT:-
file1 file11 file2 file3 greetings.txt

24. ‘rmdir -v’- displays the removing of empty directories

INPUT:-
sdb@bond007:~/MIC$ rmdir -v MIC MBT

OUTPUT:-
rmdir: removing directory, 'MIC'
rmdir: removing directory, 'MBT'

25. ‘rm’- removes files

INPUT:-
sdb@bond007:~/MIC$ rm file1
sdb@bond007:~/MIC$ ls

OUTPUT:-
file11 file2 file3 greetings.txt

26. ‘rm -i’- removes in an interactive way

INPUT:-
sdb@bond007:~/MIC$ rm -i file2
OUTPUT:-
rm: remove regular file 'file2'? y

27. ‘rm *’- removes all files with a specific pattern

INPUT:-
sdb@bond007:~/MIC$ rm file*
sdb@bond007:~/MIC$ ls

OUTPUT:-
greetings.txt

28. ‘rm -ir’- removes empty and non-empty directories with interactive mode

INPUT:-
sdb@bond007:~/MIC$ rm -ir MIC

OUTPUT:-
rm: remove directory 'MIC'? y

29. ‘rm -rv’- removes empty and non-empty directories with a visual conformation

INPUT:-
sdb@bond007:~/MIC$ rm -rv MIC

OUTPUT:-
removed directory 'MIC'

30. ‘rm -v !()’- removes all files except the mentioned file in the parenthesis

INPUT:-
sdb@bond007:~/MIC$ rm -v !(greetings.txt)

OUTPUT:-
removed 'file1.txt'
removed 'file2.txt'
removed 'file3.txt'

31. ‘cp’- copies the files


INPUT:-
sdb@bond007:~/MIC$ cp greetings.txt MBT

You might also like