Difference between revisions of "Linux Terminal - System Information"

From Computer Science
Jump to: navigation, search
(Commands)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
''This page is a part of the [[Linux and CS Systems Bootcamp]].  This page assumes you have your computer setup to connect to the CS server, or have the appropriate software installed on your computer to run commands.  Go back to the Linux and CS Systems Bootcamp main page if you don't have our system setup yet.''
+
''This page is a part of the [[Linux and CS Systems - Getting Started]].  This page assumes you have your computer setup to connect to the CS server, or have the appropriate software installed on your computer to run commands.  Go back to the Linux and CS Systems Getting Started main page if you don't have our system setup yet.''
 +
 
 +
'''Basic idea''' These are some commands that can be run to get information about the system.
 +
 
 +
'''Demo''' See [https://youtu.be/kwl1F_RY_1c this demo video] for a video demonstration of the topics on this page, including running the commands on the ISU CS server.  You should start reading through this page before watching the video.
  
 
=Commands=
 
=Commands=
Line 5: Line 9:
 
* uptime - how long since last system reboot
 
* uptime - how long since last system reboot
 
* df - information about disk free space
 
* df - information about disk free space
* whomi - which user is currently logged in on the terminal
+
* whoami - which user is currently logged in on the terminal
 
* hostname - what computer are you currently running commands on
 
* hostname - what computer are you currently running commands on
 
* pwd - which directory are you inside of
 
* pwd - which directory are you inside of
 
* clear - clear the terminal screen
 
* clear - clear the terminal screen
 
* finger - see which other users are currently logged in
 
* finger - see which other users are currently logged in
 +
* man - help about a command (manual). ''While using man - use q key to quit, and up/down arrows to scroll.''
 +
 +
=Sample Quiz=
 +
''An example quiz over this material.  After watching the video and trying the commands out yourself to make sure you understand.''
 +
 +
Fill in the blank, what is the linux command to do for each of the following.
 +
* get how long since last system reboot:
 +
* get information about disk free space:
 +
* get which user is currently logged in on the terminal:
 +
* get what computer you are currently running commands on:
 +
* get which directory are you inside of:
 +
* clear the terminal screen:
 +
* see which other users are currently logged in:
 +
* help about a command (manual):
 +
 +
=Sample HW=
 +
The following might be used by your instructor as part of a HW assignment to verify that you are able to use the these commands to get information about the system.
 +
 +
Create a directory to store files for this HW.  If you are given this assignment in one of your courses you will be told which directory to use.  We refer to this directory as HW_dir.
 +
# Create a file system-information.txt in your HW_dir
 +
# In the file, fill in the following
 +
#* Date when you ran these commands (dd-mm-yyyy, from date):
 +
#* Name of the computer you ran the commands on (from hostname):
 +
#* How long since last system reboot (from uptime):
 +
#* TB used and TB available in /u1 (from df -h):
 +
#* Command for getting uptime in how many weeks, days, hours, minutes (use <code>man uptime</code> and read the documentation, note that you type q to quite the manual):
  
 
=Sample Session=
 
=Sample Session=
Here is an example session from running on the CS server using all of these commands.  Note that the part "cs299@cs:~> " is a prompt that is printed by the terminal, and the part after this is what was typed by the userSo for the first command, the user typed the command uptime and then pressed enterThe system then printed some information on the next line, and then printed the prompt "cs299@cs:~> " again to indicate it is ready for the next command.  The prompt displays "cs299" because that is the user that was logged in running these commandsIf your username was "cs15115" then your prompt would be something like "cs15115@cs:~>".
+
The following is a transcript of the commands and screen output from the youtube video linked at the top of this pageBlank lines have been put in after each command.  You can read through the transcript and think about what you think the output will be after each command is entered, and check that this is how it shows in the transcript.   
  
You should login to one of the CS systems, open up the terminal, and try out these commands as well.  If you get an error, check that you are typing the commands exactly as they are given here. <br> [video demo]
+
Note that the transcript is for the user cs15100 logged in to the CS server.
  
 
<pre>
 
<pre>
cs299@cs:~> uptime
 
09:00:45 up 56 days, 19:35,  3 users,  load average: 0.32, 0.31, 0.32
 
cs299@cs:~> df -h
 
Filesystem      Size  Used Avail Use% Mounted on
 
/dev/root      1016G  229G  778G  23% /
 
devtmpfs        498G    0  498G  0% /dev
 
tmpfs            32M  2.3M  30M  8% /run
 
tmpfs          498G  8.0K  498G  1% /dev/shm
 
cgroup_root    8.0M    0  8.0M  0% /sys/fs/cgroup
 
/dev/sda2      127G  22G  105G  17% /usr
 
/dev/sda3      127G  8.3G  118G  7% /var
 
/dev/sda4        64G  13G  51G  20% /tmp
 
/dev/sda5        10T  2.8T  7.2T  28% /u1
 
/dev/sda6      4.0T  685G  3.3T  18% /net
 
/dev/sda7        18T  6.9T  11T  40% /store
 
cs299@cs:~> whoami
 
cs299
 
cs299@cs:~> hostname
 
cs.indstate.edu
 
cs299@cs:~> pwd
 
/u1/class/cs299
 
 
</pre>
 
</pre>

Latest revision as of 05:07, 15 January 2020

This page is a part of the Linux and CS Systems - Getting Started. This page assumes you have your computer setup to connect to the CS server, or have the appropriate software installed on your computer to run commands. Go back to the Linux and CS Systems Getting Started main page if you don't have our system setup yet.

Basic idea These are some commands that can be run to get information about the system.

Demo See this demo video for a video demonstration of the topics on this page, including running the commands on the ISU CS server. You should start reading through this page before watching the video.

Commands

The following are some commands to print information about the system.

  • uptime - how long since last system reboot
  • df - information about disk free space
  • whoami - which user is currently logged in on the terminal
  • hostname - what computer are you currently running commands on
  • pwd - which directory are you inside of
  • clear - clear the terminal screen
  • finger - see which other users are currently logged in
  • man - help about a command (manual). While using man - use q key to quit, and up/down arrows to scroll.

Sample Quiz

An example quiz over this material. After watching the video and trying the commands out yourself to make sure you understand.

Fill in the blank, what is the linux command to do for each of the following.

  • get how long since last system reboot:
  • get information about disk free space:
  • get which user is currently logged in on the terminal:
  • get what computer you are currently running commands on:
  • get which directory are you inside of:
  • clear the terminal screen:
  • see which other users are currently logged in:
  • help about a command (manual):

Sample HW

The following might be used by your instructor as part of a HW assignment to verify that you are able to use the these commands to get information about the system.

Create a directory to store files for this HW. If you are given this assignment in one of your courses you will be told which directory to use. We refer to this directory as HW_dir.

  1. Create a file system-information.txt in your HW_dir
  2. In the file, fill in the following
    • Date when you ran these commands (dd-mm-yyyy, from date):
    • Name of the computer you ran the commands on (from hostname):
    • How long since last system reboot (from uptime):
    • TB used and TB available in /u1 (from df -h):
    • Command for getting uptime in how many weeks, days, hours, minutes (use man uptime and read the documentation, note that you type q to quite the manual):

Sample Session

The following is a transcript of the commands and screen output from the youtube video linked at the top of this page. Blank lines have been put in after each command. You can read through the transcript and think about what you think the output will be after each command is entered, and check that this is how it shows in the transcript.

Note that the transcript is for the user cs15100 logged in to the CS server.