If you are unable to finish the lab in the ProLUG lab environment we ask you reboot the machine from the command line so that other students will have the intended environment.
cd~
ls
mkdirevaluation
mkdirevaluation/test/round6
# This fails, can you find out why?mkdir-pevaluation/test/round6
# This works, think about why?cdevaluation
pwd# What is the path you are in?touchtestfile1
ls
# What did this do?touchtestfile{2..10}ls
# What did this do differently than earlier?# touch .hfile .hfile2 .hfile3ls
# Can you see your newest files? Why or why not? (man ls)# What was the command to let you see those hidden files?ls-l
# What do you know about this long listing? Think about 10 things this can show you.# Did it show you all the files or are some missing?
Lab đ§Ș
This lab is designed to help you get familiar with the basics of the systems you will be working on. Some of you will find that you know the basic material but the techniques here allow you to put it together in a more complex fashion.
It is recommended that you type these commands and do not copy and paste them. Word sometimes likes to format characters and they donât always play nice with Linux.
hostname
cat/etc/*release
# What do you recognize about this output? What version of RHEL (CENTOS) are we on?uname
uname-a
uname-r
# man uname to see what those options mean if you donât recognize the values
cat/proc/cpuinfo
# What type of processors do you have? How many are there? (counting starts at 0)cat/proc/cpuinfo|grepproc|wc-l
# Does this command accurately count the processors?
df
# But df is barely readable, so find the option that makes it more readable `man df`df-h
df-h|grep-ivar
# What does this show, or search for? Can you invert this search? (hint `man grep`# look for invert or google âinverting grepâs outputâ)df-h|grep-isd
# This one is a little harder, what does this one show? Not just the line, what are# we checking for? (hint if you need it, google âwhat is /dev/sda in linuxâ)mount
# Mount by itself gives a huge amount of information. But, letâs say someone is asking# you to verify that the mount is there for /home on a system. Can you check that# quickly with one command?mount|grep-ihome
#This works, but there is a slight note to add here. Just because something isnât# individually mounted doesnât mean it doesnât exist. It just means itâs not part of# itâs own mounted filesystem.mount|grep-i/home/xgqa6cha
# will produce no outputdf-h/home/xgqa6cha
# will show you that my home filesystem falls under /home.cd~;pwd;df-h.
# This command moves you to your home directory, prints out that directory,# and then shows you what partition your home directory is on.du-sh.
# will show you space usage of just your directorytry`du-h.`aswelltoseehowthatouputdiffers
# read `man du` to learn more about your options.
uptime
manuptime
# Read the man for uptime and figure out what those 3 numbers represent.# Referencing this server, do you think it is under high load? Why or why not?
Check who has recently logged into the server and who is currently in
last
# Last is a command that outputs backwards. (Top of the output is most recent).# So it is less than useful without using the more command.last|more
# Were you the last person to log in? Who else has logged in today?w
who
whoami
# how many other users are on this system? What does the pts/0 mean on google?
Check who you are and what is going on in your environment
# Run each of these individually for understanding before we look at part b.free-m
free-m|egrepâMem|Swapâ
free-m|egrepâMem|Swapâ|awkâ{print$1,$2,$3}â
free-t|egrep"Mem|Swap"|awk'{print $1 " Used Space = " ($3 / $2) * 100"%"}'# Taking this apart a bit:# Youâre just using free and searching for the lines that are for memory and swap# You then print out the values $1 = Mem or Swap# You then take $3 used divided by $2 total and multiply by 100 to get the percentage
Have you ever written a basic check script or touched on conditional statements or loops? (Use ctrl + c to break out of these):
whiletrue;dofree-m;sleep3;done# Watch this output for a few and then break with ctrl + c# Try to edit this to wait for 5 seconds# Try to add a check for uptime and date each loop with a blank line between# each and 10 second wait:whiletrue;dodate;uptime;free-m;echoââ;sleep10;done# Since we can wrap anything inside of our while statements, letâs try adding# something from earlier:whiletrue;dofree-t|egrep"Mem|Swap"|awk'{print $1 " Used Space = " ($3 / $2) * 100"%"}';sleep3;done
seq110# What did this do?# Can you man seq to modify that to count from 2 to 20 by 2âs?# Letâs make a counting for loop from that sequenceforiin`seq120`;doecho"I am counting i and am on $i times through the loop";done
Can you tell me what is the difference or significance of the $ in the command above? What does that denote to the system?
Info
Be sure to reboot the lab machine from the command line when you are done.