Welcome to the next part of linux basic commands.

In case you have missed the previous post, or need a quick review on where we started, here is the link.

Continuing from the last post in Basic linux commands series, I am going to mention the most commonly used commands by a Linux BEGINNER.

linux basic commands

Changing the hostname

#hostnamectl  set-hostname  yourhostname.domain

The hostname can be with or without domain name.

Checking OS details

#hostnamectl

In systems based on redhat , this command will show you the OS, kernel, vendor details.

Configuring date and time

#date

This command shows you the date and time currently in your OS.

#timedatectl 

It provides more details on the timezone and the NTP status.

#timedatectl set-time 12:00

the above command will change the time to 12 o clock.

#timedatectl  set-time  2018-07-01 

This changes the date to 7th of july 2018.

Note that the command to change date and time is same. And the syntax for date and time should be strictly followed to avoid the errors.

Kernel details

#uname  -r

Shows the kernel name.

#uname  -a

Shows kernel name, version, architecture and other details.

Current directory name

#pwd

Prints the current working directory on screen. In other words shows your current location in directory hierarchy.

Shutdown

#shutdown -h 12:00

The system will shutdown at 12’o clock.

#shutdown -h now

The system will shutdown instantly.

Power off and reboot

#poweroff

powers off the OS.

#reboot

reboots the system.

You may wonder what is the difference between “shutdown and poweroff”, the first one is a systematic process whereas the later powers off the OS without closing any running programs or saving changes.

Other useful Linux basic commands

#logname

Shows the name of user logged in that terminal first.

#lastlog

Shows last successful login attempts of all user accounts.

#lastb

Gives the list of accounts which failed the login.

#tty

displays the name of current terminal.

#su username

switches to the user account mentioned in place of “username”.

 

These linux basic commands are good to start with , if you further want to explore then you can use this site link.

Leave a Reply

Your email address will not be published. Required fields are marked *