CS155

CS155: Introduction to Unix

Fall 2017

Commands 4

See this page as a slide show

Unix Commands III

CS155 Commands4

Time Commands

% date
Wed Sep 24 14:04:18 MDT 2014
% cal
   September 2014   
Su Mo Tu We Th Fr Sa
    1  2  3  4  5  6 
 7  8  9 10 11 12 13 
14 15 16 17 18 19 20 
21 22 23 24 25 26 27 
28 29 30             

System Commands

% w
 16:53:39 up 21 days, 22:02,  2 users,  load average: 1.00, 1.00, 1.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
applin   pts/2    greybull.cs.colo 16:53    0.00s  0.01s  0.00s w
dean2026 pts/3    dhcp246.cs.colos 15:29   17.00s  0.33s  0.00s sshd: dean2026

Finding Things in the Filesystem

find

find: Common Expressions

find -name pattern : search for files with name matching pattern. Pattern uses wildcard symbols.

% find ~ -name "*cs155*"
/s/chopin/k/fac/boese/mail/cs155
/s/chopin/k/fac/boese/school/cs155
/s/chopin/k/fac/boese/school/BLAHcs155YO
/s/chopin/k/fac/boese/school/cs155_logins

find: Common Expressions

% find ~ -name "*cs155*"
/s/chopin/k/fac/boese/mail/cs155
/s/chopin/k/fac/boese/school/cs155
/s/chopin/k/fac/boese/school/cs155/cs155
/s/chopin/k/fac/boese/school/cs155/cs155_logins

find: Actions

% find . -mtime -1 -ls
8798609 12 drwx--x--x  84 applin   fac  12288 Jan  1 16:43 .
8799248  4 -r--------   1 applin   fac    395 Jan  1 17:01 ./monster
1246232  4 drwxrwxr-x   3 applin   fac   4096 Jan  1 16:43 ./public_html/wiki/cookbook
find . -name "*.bak" -exec mv {} old \;

Search for a string in a selection of files (executing grep):

find . -exec grep "Boese" '{}' \; -print

find: exec

Miscellaneous Commands

Miscellaneous Commands 2

Printing in Unix

A list of CS department printers: https://www.cs.colostate.edu/~info/printers

Print Commands

Print Commands

% lpr -Ptuba my_file
% lpr -Ptuba my_file2
% lpq -Ptuba
tuba is ready and printing
Rank    Owner   Job   File(s)               Total Size
active  applin  1016  my_file               1944576 bytes
1st     xhua    1021  (stdin)               12432 bytes
2nd     applin  1028  my_file2              134144 bytes
% lprm -Ptuba 1028
% lpq -Ptuba
tuba is ready and printing
Rank    Owner   Job   File(s)               Total Size
active  xhua    1021  (stdin)               12432 bytes

Printing

Modified: 2012-09-16T15:10

User: Guest

Check: HTML CSS
Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building