DEV Community

Aditya Rawas
Aditya Rawas

Posted on • Updated on

Linux beginner to pro Commands Part 1

Are you ready to learn Linux commands? If yes then follow me here because I am going to post lists of Linux commands every day.

1. Date Command

1.Below command prints current date.
$ date
Thursday 13 May 2021 10:55:51 PM IST
Enter fullscreen mode Exit fullscreen mode
2. In case you want to know the current date/time in UTC, use following command
$ date -u
Thursday 13 May 2021 05:26:08 PM UTC
Enter fullscreen mode Exit fullscreen mode
3. Get yesterday's date
$ date --date="yesterday"
Wednesday 12 May 2021 10:58:27 PM IST
Enter fullscreen mode Exit fullscreen mode
4. Get 20 day's ago date
$ date --date="20 days ago"
Friday 23 April 2021 10:58:43 PM IST
Enter fullscreen mode Exit fullscreen mode

2. Cal Command

cal command is used to display a calendar in your shell, by default it will display the current month

1. Current month calendar
$ cal
      May 2021        
Su Mo Tu We Th Fr Sa  
                   1  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
30 31      
Enter fullscreen mode Exit fullscreen mode
2. Calendar of specific month & year (Eg: July 2019)
$ cal July 2019
     July 2019        
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 25 26 27  
28 29 30 31   
Enter fullscreen mode Exit fullscreen mode

3. whoami command

This command will display user account of system
$ whoami
aditya
Enter fullscreen mode Exit fullscreen mode

4. id command

User related all information
$ id
uid=1000(aditya) gid=1000(aditya) groups=1000(aditya),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),131(lxd),132(sambashare)
Enter fullscreen mode Exit fullscreen mode

5. pwd

This command will print relative path of preset working directory i.e your current directory location
$ pwd
/home/aditya
Enter fullscreen mode Exit fullscreen mode

6. cd command

You can leverage this command to navigate back and forth withing directories.
aditya@:~$ pwd
/home/aditya
aditya@:~$ cd test/
aditya@:test$ pwd
/home/aditya/test
aditya@:test$ cd ..
aditya@:~$ pwd
/home/aditya

Enter fullscreen mode Exit fullscreen mode
Syntax of above command to enter in particular directory is cd path_to_dir and to navigate one step down the directory is cd ..

7. ls command

1. To list files and directories inside directory
$ ls
 arrow.png   bitmap.png   Desktop   Documents   Downloads   Music   Pictures   Public   snap   Templates   test   Videos  'VirtualBox VMs'
Enter fullscreen mode Exit fullscreen mode
2. Get detail view
$ ls -l
total 76
-rw-rw-r--  1 aditya aditya  8888 Apr 14 15:57  arrow.png
-rw-rw-r--  1 aditya aditya  8888 Apr 14 15:56  bitmap.png
drwxr-xr-x  2 aditya aditya  4096 Feb 16 15:41  Desktop
drwxr-xr-x 17 aditya aditya  4096 May 10 11:54  Documents
drwxr-xr-x 23 aditya aditya 12288 May 13 21:16  Downloads
drwxr-xr-x  2 aditya aditya  4096 Feb 16 10:57  Music
drwxr-xr-x  2 aditya aditya  4096 May 13 22:30  Pictures
drwxr-xr-x  2 aditya aditya  4096 Feb 16 10:57  Public
drwxr-xr-x 10 aditya aditya  4096 May  5 09:14  snap
drwxr-xr-x  2 aditya aditya  4096 Feb 16 10:57  Templates
drwxrwxr-x  2 aditya aditya  4096 May 13 23:08  test
drwxr-xr-x  4 aditya aditya  4096 Apr 27 12:04  Videos
drwxrwxr-x  4 aditya aditya  4096 May  8 12:14 'VirtualBox VMs'
Enter fullscreen mode Exit fullscreen mode

8. mkdir command

Want to create directory? here you go fire following command
aditya@:test$ mkdir testdir
aditya@:test$ ls
testdir
Enter fullscreen mode Exit fullscreen mode

9. rm command

Want to delete directory? fire follwing command
aditya@:test$ rm -rf testdir/
aditya@:test$ ls
aditya@:test$ 
Enter fullscreen mode Exit fullscreen mode

10. touch command

1. Create empty files using touch command
aditya@:test$ ls
aditya@:test$ touch test.txt
aditya@:test$ ls
test.txt
Enter fullscreen mode Exit fullscreen mode
2. Create 10 empty files using touch.
aditya@:test$ touch text.txt{1..10}
aditya@:test$ ls
text.txt1  text.txt10  text.txt2  text.txt3  text.txt4  text.txt5  text.txt6  text.txt7  text.txt8  text.txt9
Enter fullscreen mode Exit fullscreen mode

Did you liked this post.? If yes then this is not the end I am going to post more such beginner level command and then later going to go more in details this series is going to make you go from beginner to pro Linux administrator... !!! Stay tuned !!!!!

Aditya Rawas Coffee

Top comments (0)