Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Aditya Rawas
Aditya Rawas

Posted on • Edited 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.
$ dateThursday 13 May 2021 10:55:51 PM IST
Enter fullscreen modeExit fullscreen mode
2. In case you want to know the current date/time in UTC, use following command
$ date -uThursday 13 May 2021 05:26:08 PM UTC
Enter fullscreen modeExit fullscreen mode
3. Get yesterday's date
$ date --date="yesterday"Wednesday 12 May 2021 10:58:27 PM IST
Enter fullscreen modeExit 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 modeExit 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 modeExit 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 modeExit fullscreen mode

3. whoami command

This command will display user account of system
$ whoamiaditya
Enter fullscreen modeExit fullscreen mode

4. id command

User related all information
$ iduid=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 modeExit 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 modeExit fullscreen mode

6. cd command

You can leverage this command to navigate back and forth withing directories.
aditya@:~$ pwd/home/adityaaditya@:~$ cd test/aditya@:test$ pwd/home/aditya/testaditya@:test$ cd ..aditya@:~$ pwd/home/aditya
Enter fullscreen modeExit fullscreen mode
Syntax of above command to enter in particular directory iscd path_to_dir and to navigate one step down the directory iscd ..

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 modeExit fullscreen mode
2. Get detail view
$ ls -ltotal 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.pngdrwxr-xr-x  2 aditya aditya  4096 Feb 16 15:41  Desktopdrwxr-xr-x 17 aditya aditya  4096 May 10 11:54  Documentsdrwxr-xr-x 23 aditya aditya 12288 May 13 21:16  Downloadsdrwxr-xr-x  2 aditya aditya  4096 Feb 16 10:57  Musicdrwxr-xr-x  2 aditya aditya  4096 May 13 22:30  Picturesdrwxr-xr-x  2 aditya aditya  4096 Feb 16 10:57  Publicdrwxr-xr-x 10 aditya aditya  4096 May  5 09:14  snapdrwxr-xr-x  2 aditya aditya  4096 Feb 16 10:57  Templatesdrwxrwxr-x  2 aditya aditya  4096 May 13 23:08  testdrwxr-xr-x  4 aditya aditya  4096 Apr 27 12:04  Videosdrwxrwxr-x  4 aditya aditya  4096 May  8 12:14 'VirtualBox VMs'
Enter fullscreen modeExit fullscreen mode

8. mkdir command

Want to create directory? here you go fire following command
aditya@:test$ mkdir testdiraditya@:test$ lstestdir
Enter fullscreen modeExit fullscreen mode

9. rm command

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

10. touch command

1. Create empty files using touch command
aditya@:test$ lsaditya@:test$ touch test.txtaditya@:test$ lstest.txt
Enter fullscreen modeExit fullscreen mode
2. Create 10 empty files using touch.
aditya@:test$ touch text.txt{1..10}aditya@:test$ lstext.txt1  text.txt10  text.txt2  text.txt3  text.txt4  text.txt5  text.txt6  text.txt7  text.txt8  text.txt9
Enter fullscreen modeExit 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)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Hi I amAditya Rawas.Passionate front-end dev 🧑‍💻with clean design focus
  • Location
    Maharashtra, India
  • Work
    Senior Full stack developer
  • Joined

More fromAditya Rawas

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp