Thursday, February 28, 2019

UNIX COMMAND

1. Find the current time and date.

[bgc@localhost ~]$ date
Thu Aug 23 04:54:01 EDT 2018
[bgc@localhost ~]$

2. Create a blank file.

[bgc@localhost ~]$ touch aniket.txt
[bgc@localhost ~]$

3. Create a file and write some sentences on the file.

[bgc@localhost ~]$ cat>file1.txt
today is thursday
I am a student
Bhairab Ganguly College
[bgc@localhost ~]$

4. Display the content of the file file1.txt

[bgc@localhost ~]$ cat file1.txt
today is thursday
I am a student
Bhairab Ganguly College
[bgc@localhost ~]$

5. Append some lines in a text file.

[bgc@localhost ~]$ cat>>file1.txt
tomorrow is friday
[bgc@localhost ~]$ cat file1.txt
today is thursday
I am a student
Bhairab Ganguly College
tomorrow is friday
[bgc@localhost ~]$

6. Create a directory or folder.

[bgc@localhost ~]$ mkdir Aniket
[bgc@localhost ~]$

7. Display all files and directories under the current directory.

[bgc@localhost ~]$ dir
10.sh~      7.sh~      even   nelash.sh
143.cpp~      8a.sh      evenoddchecking.sh   nelash.sh~
144.cpp~      8a.sh~      evenoddchecking.sh~  nelash.txt
145.cpp~      8.sh      f1   nelash.txt~
146.cpp~      8.sh~      f2.cpp~   odd
147.cpp~      9.sh~      f8.cpp~   p1.cpp~
148.cpp.cpp~  a      file1.txt   p2.cpp~
149.cpp~      A\ K\ PATWA\ 9564\ BGC  file.c~   p3.cpp~
150.cpp~      aman~      file.txt   paddy
151.cpp~      aman2~      file.txt~   paddy1.txt
152.cpp~      Aniket      final.c   Pictures
153.cpp~      aniket.txt      first.c~   Public
154.cpp~      aniket.txt~      F_to_c.cpp~   puli1.c~
1.sh      archie.sh      HMS.cpp~   rajdeep.doc
1.sh~      archie.sh~      joy   rajdeep.txt
2.sh      Archisman.sh      joy1.sh   rajdeep.txt~
2.sh~      Archisman.sh~      joyblank.sh   reverse.sh
3.sh      Archisman.txt      joyblank.sh~   reverse.sh~
3.sh~      Archisman.txt~      joymarks.sh   sdsir.c~
4.sh      arm.sh      joyword.sh   source.txt
4.sh~      arm.sh~      joyword.sh~   student1.txt
5.sh      assignment1.sh      joyyy.sh   student1.txt~
5.sh~      assignment1.sh~      joyyy.sh~   t19.txt
6a.sh~      bubble.c~      km_to_mile.cpp~   t2.txt
6b.sh~      checking.sh      linear.sh   t2.txt~
6c.sh~      Debayan      linear.sh~   Templates
6.sh      Desktop      Music   triangle.txt~
6.sh~      destination.txt      nealash2.txt   Untitled\ Folder
7a.sh~      Documents      nelash2.sh   Videos
7b.sh~      Downloads      nelash2.sh~   vowelcheck.txt
7c.sh~      DtoB.sh      nelash3.sh
7.sh      DtoB.sh~      nelash3.sh~
[bgc@localhost ~]$

8. Display all files and directories under the current directory.

[bgc@localhost ~]$ ls
10.sh~        7.sh~      even nelash.sh
143.cpp~      8a.sh      evenoddchecking.sh nelash.sh~
144.cpp~      8a.sh~      evenoddchecking.sh~ nelash.txt
145.cpp~      8.sh      f1 nelash.txt~
146.cpp~      8.sh~      f2.cpp~ odd
147.cpp~      9.sh~      f8.cpp~ p1.cpp~
148.cpp.cpp~  a      file1.txt p2.cpp~
149.cpp~      A K PATWA 9564 BGC  file.c~ p3.cpp~
150.cpp~      aman~      file.txt paddy
151.cpp~      aman2~      file.txt~ paddy1.txt
152.cpp~      Aniket      final.c Pictures
153.cpp~      aniket.txt      first.c~ Public
154.cpp~      aniket.txt~      F_to_c.cpp~ puli1.c~
1.sh          archie.sh      HMS.cpp~ rajdeep.doc
1.sh~         archie.sh~      joy rajdeep.txt
2.sh          Archisman.sh      joy1.sh rajdeep.txt~
2.sh~         Archisman.sh~      joyblank.sh reverse.sh
3.sh          Archisman.txt      joyblank.sh~ reverse.sh~
3.sh~         Archisman.txt~      joymarks.sh sdsir.c~
4.sh          arm.sh      joyword.sh source.txt
4.sh~         arm.sh~      joyword.sh~ student1.txt
5.sh          assignment1.sh      joyyy.sh student1.txt~
5.sh~         assignment1.sh~     joyyy.sh~ t19.txt
6a.sh~        bubble.c~      km_to_mile.cpp~ t2.txt
6b.sh~        checking.sh      linear.sh t2.txt~
6c.sh~        Debayan      linear.sh~ Templates
6.sh          Desktop      Music triangle.txt~
6.sh~         destination.txt     nealash2.txt Untitled Folder
7a.sh~        Documents      nelash2.sh Videos
7b.sh~        Downloads      nelash2.sh~ vowelcheck.txt
7c.sh~        DtoB.sh      nelash3.sh
7.sh          DtoB.sh~      nelash3.sh~
[bgc@localhost ~]$

9. Details of all processes that are currently executing

[bgc@localhost ~]$ ps
 PID   TTY       TIME CMD
2807 pts/1    00:00:00 bash
2889 pts/1    00:00:00 ps

[bgc@localhost ~]$