SPR720 Lab

SPR720 Bash Scripting Lab

2. Display the longest and shortest usernames on the system (usernames are in the first field in /etc/passwd).



for USER_NAME in $(cut -f1 -d: /etc/passwd)
   if [[ ${#USER_NAME} -gt MAX_LEN ]]
   elif [[ ${#USER_NAME} -lt MIN_LEN ]]

echo “The longest user name is $MAX_LEN_USERNAME”
echo “The shortest user name is $MIN_LEN_USERNAME”


3. Count the number of users with user IDs between 500 and 10000 on the system (user IDs are the third field in /etc/passwd).



for USER_ID in $(cut -f3 -d: /etc/passwd)
   if [ “$USER_ID” -ge 500  -a “$USER_ID” -le 10000 ]
      echo $USER_ID

echo “The number of  user IDS between 500 and 10000 is $NUM_USER”

6. Count the number of files in the user’s home directory which are not readable.



for FILE_NAME in ~/*
   if [ ! -r “$FILE_NAME” -a -f “$FILE_NAME” ]
   echo $FILE_NAME

echo “The number of files in $HOME which are not readable is $NUM_FILE”



SPR720 Command Lab

Task 1 — Examine the /bin, /usr/bin/, /sbin, and /usr/sbin directories. For each directory, examine the number and type of commands


$ ls /bin|wc -l



$ ls /usr/bin|wc -l



$ ls /sbin|wc -l



$ ls /usr/sbin|wc -l




Task2 — Go through the files in /usr/bin and for each file, note whether it’s a command you have used. Select 25 of the commands you haven’t used and research what they do



A2p takes an awk script specified on the command line (or from standard input) and produces a comparable perl script on the standard output.



ab  is  a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current  Apache  installation  performs.  This especially shows you how many requests per second your Apache installation is capable of  serving.



ac  prints  out  a  report  of connect time (in hours) based on the logins/logouts in the current wtmp file.  A total is also printed out.



aconnect  is  a utility to connect and disconnect two existing ports on ALSA sequencer system.  The ports with the arbitrary subscription permission, such as created by aseqview(1), can be connected to any (MIDI) device ports using aconnect.



The afs5log command uses Kerberos to obtain AFS tokens for the named cells.  If no cell is named, tokens are obtained for the local cell. If the principal name of the afs service for the cell is known, the cell name may also be given in the form cell=principal_name.   Attempts are made to obtain Kerberos IV credentials first, and if that fails, afs5log will create Kerberos 5 (2b-style) tokens.



baobab is able to scan either specific folders or the whole filesystem (local and remote), in order to give the user a graphical tree representation including each directory size or percentage in the branch. It also auto-detects in real-time any change made to your home directory as far as any mounted/unmounted device. A graphical treemap window is also provided for any selected folder.



Base64 encode or decode FILE, or standard input, to standard output.



Bdftopcf is a font compiler for the X server and font server.  Fonts in Portable Compiled Format can be read by any architecture, although the file  is  structured  to allow one particular architecture to read them directly without reformatting.  This allows fast reading on the appropriate machine, but the files are still portable (but read more slowly) on other machines.



bmp2tiff converts a Microsoft Windows Device Independent  Bitmap  image file  to TIFF.  If several input BMP files are being specified the multipage TIFF output file will be created. By default, the TIFF image is created with data samples packed (PlanarConfiguration=1), compressed with the PackBits algorithm (Compression=32773), and with each strip no more than 8 kilobytes. These characteristics can overridden, or explicitly specified with the options described below.



bzip2  compresses  files  using  the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. Compression is generally considerably   better   than   that achieved by more conventional LZ77/LZ78-based compressors, and approaches the performance of the PPM family of statistical compressors.



The capiinfo program checks how many controllers are installed and calls CAPI_GET_PROFILE for each of them. Also it sends a FACILITY_REQ capi message to get the information for the facilities supported by each controller. The information is shown on STDOUT.



Print a reference card of the PROGRAMs thanks to their inline help.



This tool allow to list, add, remove or extract certificates, certificate revocation lists (CRL) or certificate trust lists (CTL) to/from a certificate store. Certificate stores are used to build and validate certificate chains for Authenticode(r) code signing validation and SSL server certificates.



Print CRC checksum and byte counts of each FILE.



The command chvt N makes /dev/ttyN the foreground terminal.  (The corresponding screen is created if it did not exist yet.  To get rid of unused VTs, use deallocvt(1).)  The key combination (Ctrl-)LeftAlt-FN(with N in the range 1-12) usually has a similar effect.




dasher is an information-efficient text-entry interface, driven by natural continuous pointing gestures. Dasher is a competitive text-entry system wherever a full-size keyboard cannot be used.



Print  NAME  with  its trailing /component removed; if NAME contains no /’s, output ‘.’ (meaning the current directory).



djpeg  decompresses  the  named  JPEG file, or the standard input if no file is named, and produces an image file on the standard output.  PBM-PLUS (PPM/PGM),  BMP,  GIF, Targa, or RLE (Utah Raster Toolkit) output format can be selected.



dvcont  is a command line tool to send control commands via an IEEE1394 link to a device that implements the AV/C specifications by the 1394 Trade Association.  Or for the non-techies: dvcont lets you remote control your DV camera via a Firewire cable.



dvitomp  translates  the  given  dvifile  to  a  MetaPost MPXFILE.  The default mpxfile is the basename of dvifile extended with “.mpx”.



e2pall  searches  through TEXFILE for \includegraphics commands to find the base names  of  image  files.   When  it  finds  one,  e2pall  runs epstopdf(1) to create a PDF file from the EPS file.



Enchant is an ispell-compatible spellchecker.



Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.



Convert tabs in each FILE to spaces, writing to standard output.  With no FILE, or when FILE is -, read standard input.



Wrap  input  lines in each FILE (standard input by default), writing to standard output.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: