0% found this document useful (0 votes)
38 views

Linux Command

This document provides an overview of several common Linux commands including whoami, echo, hostname, uname, history, clear, uptime, cal, date, man, top, htop, nano, and vim. It explains what each command does and how to use basic options and keyboard shortcuts. For example, whoami displays the logged in username, echo prints text to the screen, and top displays active processes. The document also covers using up/down arrows to navigate command history and Control-C/Control-X to exit programs like top and nano.

Uploaded by

Afuye Raymond
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Linux Command

This document provides an overview of several common Linux commands including whoami, echo, hostname, uname, history, clear, uptime, cal, date, man, top, htop, nano, and vim. It explains what each command does and how to use basic options and keyboard shortcuts. For example, whoami displays the logged in username, echo prints text to the screen, and top displays active processes. The document also covers using up/down arrows to navigate command history and Control-C/Control-X to exit programs like top and nano.

Uploaded by

Afuye Raymond
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Different operating system

Command line structure


• Command option files/data
WHOAMI COMMAND
• It will display the username that is logged with this system. 
• Usually on a Linux system, you will have to log first 
• with a username and password. 
• And of course, Linux is multi-user so you 
• can have different users with different passwords.
• And each user will have a home directory with different files, et
cetera. 
Whoami --help
Id command
logname
Echo Command
• So another command very basic is echo. 
• And it will just echo what you type after. 
• For example, echo hello. 
• And it will just print hello. 
• Or a specific echo is echo $0.
• And this will not display $0. 
• It will display the name of the interpreter of all the commands
Hostname
Uname
• uname space -a (minus a), and Enter. 
• Oh, we have a little bit more explanation here. 
• So we have Linux, which is the name of the system, openrisk, which 
• is the name of the hostname of the computer. 
• And then you have a bunch of numbers here
• And this is the version of Linux that is running. 
• And when it was built, I think, and also openrisk GNU Linux. 
• so we are running some GNU under the hood.
History command
• The other ones, it's just what I did. 
• But to go back to an old command, you can use the up arrow. 
• So if I hit the up arrow, just now, I will get to the last command. 
• And again up arrow, uname -a, up arrow. 
• And you go up like this, up to the number 
• 2, which is the first command that I just typed. 
• If I want to go back down, then I just hit the down arrow, 
• and I go down that list, just like this. 
• So you can navigate through the history using the other arrows, 
• up and down arrows like this
Clear Command
• if I want to clear, well it's the command clear. 
Uptime Command
uptime will display how many minutes until the system was booted, 
so here we can see the hour. And then we can see that it is up for nine
minutes now. And you can just see a bunch of other statistics like the
load average, which is the load average of the CPU.
Cal command/ cal -j
• So here, I can use an option, -j to use Julian dates
• cal then space -j. 
• And it will display the number of days since the 1st of January. 
• So you have a Julian dates for this calendar.
Date Command
• date +"%A %d %B %Y"
• ook at this example. 
• date +"%T" Ooo. 
• We have only the time that is displayed. 
• And if I type date +"%A %d %B %Y" and then we close the quotes. 
• Press Enter. 
• Ooh. 
• We have something very interesting here. 
• We have a percent A that is Thursday, Percent d 13. 
• Percent B, September. 
• Percent Y, 2018
MAN
• But, on the real Linux system, you would use the man command. 
• The man command is the manual of command. 
• Of course, you can have a manual of cal by using man cal for example
Interactive commands: top, htop, nano, vim, how to get
back to the prompt

• Top --help
Top command
Top-help command
Q or cont
• So Control-C means that if you push these two buttons, 
• these two keys, then you will go back to the command prompt 
• and it will exit the command
• execute top. 
• And as you can see, the program is running. 
• And at the bottom left, you have this blinking cursor
• 
• I just type S and it did something with the program anyway. 
• So let's try to type the Q
type Control C
htop command
Nano command
• And at the very bottom, you have a kind of menu. 
• It's a key menu. 
• And you can see here, we have always a carrot or the circumflex accent with G 
• to get help or carrot X to exit, or carrot O to write out 
• or to read a file, et cetera. 
• So here, I imagine that carrot X means that you 
• have to push the Control and the X keys to exit the program. 
• So let's try Control X, and indeed, we just exited nano. 
• Let's go back to nano, and let's try Control C, if it works. 
• Oh, it did something because you have something that is written here, 
• but he didn't exit the program. 
• So Control C is doing something, and indeed here, 
• you can see in the menu that Control-C and those, 
• I don't know, it's written curve pose, but I don't know what it means. 
• Maybe if I can get help. 
• So let's right Control J--
Vim command
test

You might also like