Linux Operating Systems



Chapter 04: Basic Commands


Basic Commands and Operations

[root@lab ~]# ls     List the contents of the current directory
[root@lab ~]# dir List the contents of the current directory
[root@lab ~]# ls -l List the contents of the current directory as well as the properties
[root@lab ~]# ll List the contents of the current directory as well as the properties
[root@lab ~]# vdir List the contents of the current directory as well as the properties
[root@lab ~]# cd directory Change the working directory
[root@lab ~]# pwd Display the working directory
[root@lab ~]# echo text Display a line of text
[root@lab ~]# echo $PATH Display a variable

Time an operation

Syntax
time command
Example
[eninam@localhost ~]$ time pwd
Terminate the shell
[eninam@localhost ~]$ exit
[eninam@localhost ~]$ logout

[root@lab ~]# hostname Dipslay your host machine name
[root@lab ~]# hostname name change your host machine name temporary
[root@lab ~]# reboot restart machine
[root@lab ~]# hostnamectl set-hostname hostname Change System Host name stored in /etc/hostname

Shutdown System

[root@lab ~]# systemctl poweroff

[root@lab ~]# shutdown –option time [+]

[root@lab ~]# init 0

Time

[root@lab ~]# date     display date
[root@lab ~]# cal display calendar
[root@lab ~]# cal month year display calendar
[root@lab ~]# cal 7 2030 display 2030 July calendar
[root@lab ~]# cal 2030 display 2030 calendar
[root@lab ~]# timedatectl display time settings
[root@lab ~]# timedatectl set-time YYYY-MM-DDChange the Current Date (root)
[root@lab ~]# timedatectl set-time 2013-06-02 Change the Current Date (root)
[root@lab ~]# timedatectl set-time HH:MM:SSChanging the Current Time (root)
[root@lab ~]# timedatectl set-ntp true Activate NTP Client
[root@lab ~]# timedatectl set-ntp false Deactivate NTP Client
[root@redhat ~]# timedatectl list-timezones
[root@redhat ~]# timedatectl set-timezone time_zone

Language

Change system language
Syntax
localectl set-locale language-code

Example
[root@localhost eninam]# localectl set-locale LANG=fr_FR.utf8

Language selection for a command
Example
[eninam@localhost ~]$ LANG=fr_FR.utf8 cal Display calendar in french


[root@localhost eninam]# clear erase shell prompt

[root@localhost eninam]# history show user recently used commands



Eninam BAGNABANA     |         |     bagnadavid@outlook.fr     |