Table of Contents

unix Journals

Jan 28, 2013

Feb 02, 2013

Feb 10, 2013

Feb 18, 2013

Somehow I missed doing the second part of this past week’s work regarding unconventional naming.

“Using the redundant ./ directory information prevents the dash from occurring at the beginning of the file name, and being interpreted as an option of the rm command.” -kb.iu.edu/data/abao.html - web

Feb 27, 2013

LAB 0X3

VIM Tutorial

The Puzzle Box

March 09, 2013

LAB 0X4

Dot - Files

echo utility

Command Aliases

History

Tab completions

March 20, 2013

LAB 0X5

Creating files with the touch utility

Using wildcards

I/O Redirection

Filtering unwanted information

ls: cannot access file555: No such file or directory

Pagers

Quotes

Mar 25, 2013

Web Pages Exercise

Apr 04, 2013

Simple script

Running Script1.sh

Simple I/O

Arithmetic

read birth_year current_year=2013 let age=current_year-birth_year echo your age is $age

I was trying

read birth_year current_year='date +”%Y“' let age=current_year-birth_year echo your age is $age

HAHA!

read birth_year current_year=$(date +”%Y“) let age=current_year-birth_year echo your age is $age

WORKS! -

shabang

Selection Statements

Selection

lab46:~$ vi guess1.sh

#!/bin/bash pick=$1)

echo “$pick” echo “Pick a number between 1 and 20:” read num1 if [ “$num1” -eq “$pick” ] ; then

echo "Congratualtions $num1 was the randomly selected number!"

else

echo "Sorry try again, pick another number between 1 and 20:"

read num2 fi

if [ “$num2” -eq “$pick” ] ; then

echo "Congratulations $num2 was the randomly selected number!"

else

echo "Sorry try again, pick another number between 1 and 20:"

read num3 fi

if [ “$num3” -eq “$pick” ] ; then

echo "Congratualtions $num3 was the randomly selected number!"

else

echo "Sorry try again, select another number between 1 and 20:"

read num4 fi

if [ “$num4” -eq “$pick” ] ; then

echo "Congratualtions $num4 was the randomly selected number!"

else

echo "Sorry $num4 was not the randomly selected number"

fi

Apr 09, 2013

Numeric Loop, finally got this to not cover my screen in the number 20!

#!/ in/bash

for 2) ; do echo -n “$i ” ; done

Apr 20, 2013

Job Control and Multitasking

UNIX by nature proves to be a multitasking OS just by the ability of providing multiple terminals and the use of daemons to perform routine tasks with in the system. Navigating these terminals and knowing how to take advantage of UNIX multitasking abilities will enable one to use the system more efficiently and effectively. Some of the basic commands used to take advantage of the systems multitasking abilities are ps, top, jobs, fg and kill.

ps - for “process” outputs a list of processes you are currently running, adding options can output additional information or more specific information on the processes running.

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND ddenunz2 24433 0.0 0.0 11000 1400 pts/38 TN 14:13 0:00 top ddenunz2 24508 0.0 0.0 8588 992 pts/38 RN+ 14:47 0:00 ps u ddenunz2 24569 0.0 0.1 13636 2012 pts/38 SNs Apr20 0:01 -bash ddenunz2 30390 0.0 0.0 13596 12 pts/41 SNs Jan26 0:00 /bin/bash ddenunz2 30394 0.0 0.1 42516 2396 pts/41 SN+ Jan26 14:51 irssi

lab46:~$ ps aux | grep inetd root 947 0.0 0.0 8328 120 ? Ss Jan14 0:00 /usr/sbin/inetd ddenunz2 24886 0.0 0.0 10092 876 pts/38 SN+ 15:00 0:00 grep inetd

Top - displays processes running in real time and in addition some system information such as CPU and memory usage, up time and connected users.

Running in the Background

Command Separator Task 1

Task2

Killing Processes

Who output with two login instances:

Last login: Sun Apr 21 16:25:49 2013 from dynamic-acs-64-22-55-242.zoominternet. net lab46:~$ who NAME LINE TIME IDLE PID COMMENT mgough + pts/7 2013-01-17 10:26 old 29872 (rrcs-50-75-106-214:S .0) synack + pts/9 2013-04-14 02:30 old 28070 (69.194.56.177) smalik2 + pts/18 2013-01-20 15:14 old 26721 (mobile-198-228-195-0 67:S.0) wedge - pts/24 2013-04-21 07:38 00:30 21527 (10.80.81.2) smeas + pts/33 2013-02-27 20:11 04:38 3474 (li583-226:S.0) mowens3 + pts/64 2013-04-21 16:52 00:33 26002 (cpe-69-205-136-233.s tny.res.rr.com) ddenunz2 + pts/71 2013-04-21 17:25 . 26274 (dynamic-acs-64-22-55 -242.zoominternet.net) wedge - pts/70 2013-04-21 17:03 . 26138 (10.80.81.2) ddenunz2 + pts/41 2013-01-26 11:06 old 30390 (dynamic-acs-64-22-55 -242:S.0) jcavalu3 + pts/54 2013-04-19 15:48 old 15136 (10.80.3.174) mowens3 + pts/62 2013-04-21 16:33 00:51 25583 (cpe-69-205-136-233.s tny.res.rr.com) thakes3 + pts/53 2013-04-12 12:02 old 10983 (caprisun.offbyone.la n) ddenunz2 + pts/38 2013-04-21 16:25 00:03 25559 (dynamic-acs-64-22-55 -242.zoominternet.net) mgough + pts/0 2013-03-09 00:09 15:54 2545 (rrcs-50-75-106-214:S .1) tedmist1 + pts/94 2013-03-20 11:51 22:24 20894 (lab46.offbyone.lan) lab46:~$

Applying my Skills 11. a.) ps -u statd

  b.) lab46:~$ ps -A | grep 'init'

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 8356 92 ? Ss Jan14 1:40 init [2]

The PID for init is 1.

  c.) root owns the cron process. Cron is driven by a configuration file that schedules the processing of jobs for users and daemons.
1)
RANDOM % 20
2)
i=20; i>=2; i-=2