Hope that you are well and enjoying the Linux. Yes, Linux is much more interesting, because, you can customize it as your wish. In this post we’ll see some Linux basic command.
Linux basic command using CLI (more)
Before going to the next part, just remember this small topics.
“ ~ ” >> home directory.
“ / ” >> root partition
“ /root ” >> home directory used by root user
“ /home ” >> user’s home
Now in this post we’ll see some basic and interesting command.
Lets enjoy them.
[ece@localhost Desktop]$ su root
Password:
Command:
[root@localhost ~]# whoOutput:
ece :0 2016-05-05 22:17 (:0)
ece pts/0 2016-05-05 22:17 (:0)
Command:
[root@localhost ~]# whoamiOutput:
Root
Command: To show the hostname:
[root@localhost ~]# hostname
Output:
localhost.localdomain
Want to see the current date?? Just write date in CLI :
[root@localhost ~]# date
See!! Current date is showing!!
Thu May 5 23:41:00 EDT 2016
Now we’ll see the current date of our machine.
Just type cal. It will show the present month.
[root@localhost ~]# cal
Now if you want to show the calendar of a year, then can type this:
[root@localhost ~]# cal 2017
Want to see the last unsuccessful login?? Here it is.
[root@localhost ~]# lastb
btmp begins Thu May 5 08:42:02 2016
See the run level (5-GUI, 3-CMD, n-none)
[root@localhost ~]# runlevel
N 5
Through this command you can see the kernel version:
[root@localhost ~]# uname -r
Want to see the operating system name??
[root@localhost ~]# uname
Linux
See the current version from these command.
[root@localhost home]# vi /etc/centos-release
CentOS Linux release 7.2.1511 (Core)
Task manager:
[root@localhost ~]# top
Login details:
[root@localhost ~]# lastlog
Username Port From Latest
root pts/0 Thu May 5 22:18:46 -0400 2016
bin **Never logged in**
daemon **Never logged in**
RAM info:
[root@localhost ~]# free -m
Mem: 977 522 60 8 395 283
Swap: 511 0 511
[root@localhost ~]# df -HT
tmpfs tmpfs 513M 156k 513M 1% /dev/shm
tmpfs tmpfs 513M 7.5M 506M 2% /run
tmpfs tmpfs 513M 0 513M 0% /sys/fs/cgroup
/dev/sda1 xfs 4.2G 208M 4.0G 5% /boot
tmpfs tmpfs 103M 4.1k 103M 1% /run/user/42
tmpfs tmpfs 103M 8.2k 103M 1% /run/user/1000
/dev/sr0 iso9660 4.4G 4.4G 0 100% /run/media/ece/CentOS 7 x86_64
System uptime info:
[root@localhost ~]# uptime
23:43:23 up 1:26, 2 users, load average: 0.03, 0.04, 0.05
IP address info:
[root@localhost ~]# ip addr
List of previous history:
[root@localhost ~]# history
1 nmcli connection show
2 nmtui
3 nmtui
Want to change directory??
[root@localhost ~]# cd /
See the list:
[root@localhost /]# ls
Change the directory to the location /var/log:
[root@localhost /]# cd /var/log
Now going back to /var from /log
[root@localhost log]# cd .. [root@localhost var]# cd –/var/log
[root@localhost log]# cd / [root@localhost /]# cd home
Through the “mkdir” command you can make a directory. Here I’ve created a directory named “test”
[root@localhost home]# mkdir test
Now going to the directory named “test”
[root@localhost home]# cd test
The “pwd” command shows you the present working directory.
[root@localhost test]# pwd/home/test
[root@localhost test]#
That’s the end of this post. Hope that you have enjoyed. Thanks for visiting here.
Hoping for your return.
Leave a Reply