CPSC 826 Quiz #2 Solutions

Total Page:16

File Type:pdf, Size:1020Kb

CPSC 826 Quiz #2 Solutions CPSC 424/624 Quiz #4 Solutions Closed book/computers Spring 2017 Last update: 3/3/2017 Name: 1 Create a simple Bash command line pipeline involving the find utility to assemble a set of files and then have this result piped to wc to sum the number of lines . You should use xargs in your pipeline. Explain what xargs does, using your example to illustrate. Include in your summary what would happen if your pipeline did not use xargs. For example, what is the problem if you were to run your pipeline but without using xargs. Based on this exercise (along with any additional reading), please explain the benefits of xargs. Solution: xargs [option ...] [command [initial-arguments]] xargs is another way to call commands or programs. The term xargs is synonymous with 'combine arguments'. It builds and executes command lines by gathering together arguments from standard in (which as we will see are many times supplied by find) A simple example….in a directory, issue the following: #ls; ls | wc; ls | xargs; ls | xargs | wc; From the bashScripts/monitors directory, the command line result is: 1 ls; 2 monitorScriptRunzhen.py monitorScriptRunzhen.sh mySysMon.sh paul.py paul.sh tecmint_monitor.sh xin.py xin.sh 3 ls | wc; 4 8 8 109 5 ls | xargs; 6 monitorScriptRunzhen.py monitorScriptRunzhen.sh mySysMon.sh paul.py paul.sh tecmint_monitor.sh xin.py xin.sh 7 ls | xargs | wc 8 1 8 109 9 ls | xargs wc 10 72 208 1885 monitorScriptRunzhen.py 11 57 184 1787 monitorScriptRunzhen.sh 12 63 206 1456 mySysMon.sh 13 82 219 1866 paul.py 14 64 201 1444 paul.sh 15 117 491 4015 tecmint_monitor.sh 16 75 252 2329 xin.py 17 59 124 1167 xin.sh 18 589 1885 15949 total Lines 1 and 2 display the output of ‘ls’- a list of filenames with each separated by a ‘\n’. Lines 3-4 counts the number of results. Line 5-6 shows that xarg’s will gather the results from the previous command and places them in a single line. Note that od is useful….. try ls | od –c and then ls | xargs –c If a program is specified to xargs (wc in our example), xargs calls the program passing the data from the pipe as parameters. If xargs is used without a p, total of program, it defaults to issuing an echo of the parameters. Lines 7 and 8 (ls | xargs | wc) pipes to wc effectively a string (1 line, 8 words…) Line 9- 18 - (ls | xargs wc ) causes wc to be invoked with 8 parameters….wc interprets each as a file name, and provides the wc output for each file on a separate line. Xargs adds flexibility to command lines – it allows pipelines that would require a more complicated script to achieve without xargs. GNU’s parallels can be viewed as a replacement of xargs, adding support for concurrency. 2 On your VM, issue the following commands: sleep 5; alert; Poke around on your VM to learn about ‘alert’. What is the most effective method for learning about something you see used in a command line? Once you have found alert, explain how it works. So…if it is a program, deduce how it works. If it is a script, decompose it to learn and then explain how it works. Solution: The type command is usually the best way as it can give you the information needed to know roughly what to look for. Using type, we find that ‘alert’ is an alias. With a bit of digging you would find the alias in ./bashrc. type alert alert is aliased to `notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e 's/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//')"' `notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e 's/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//')"' Decomposing the alias: Notify-send is a program allowing a script to send desktop notifications. The –i allows the caller to specify a graphics icon that will be displayed with the message. Executing the following: `notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e 's/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//')"` Does display a msg (upper left of desktop) but the txt message is the actual shell code between the backquotes. Why? It is doing the right thing….it is displaying the last command….in this case the notify- send. When called by the alias, the last command is delay 5 3 The following script (paul.sh) is available at https://people.cs.clemson.edu/~jmarty/courses/Spring 2017/CPSC424/code/bashScripts/monitors/. This following is an excerpt from the monitor script. If invoked as ‘./paul.sh 5 enp0s17’ it will send the following information to standard out every 5 seconds. The second param is the network interface name (use ifconfig to get this) we want to monitor. Please answer the following questions: On lines 24-25, explain exactly what a ‘5 minute load CPU utilization ‘ is and second, exactly how this code obtains that information On lines 27-31, explain what exactly the awk code produces and explain exactly how the awk code actually works. Interval (sec): 5 Inteface: enp0s17 Number of Cores: 1 5 Minute Avg CPU Utilization (%): 8.0 Outbound BW (bits): 0 Inbound BW (bits): 0 1 #!/bin/bash 2 # System Health Monitor 3 # monitorScript.sh 4 interval=$1 5 interface=$2 6 if [ "$#" -ne 2 ] 7 then 8 echo 9 echo "Usage: $0 <interval> <interface>" 10 echo 11 exit 1 12 fi 13 declare -i tempOut=0 14 declare -i tempIn=0 15 while true; do 16 clear 17 echo "Interval (sec): "$'\t'"$interval" 18 echo "Inteface: "$'\t'"$interface" 19 echo -n "Number of Cores: "$'\t' 20 cores=$(grep pro /proc/cpuinfo -c) 21 echo $cores 22 # - CPU Utilization 23 echo -n "5 Minute Avg CPU Utilization (%): "$'\t' 24 util=$(cat /proc/loadavg | awk '{print $1}') 25 echo "scale=1; (($util*100)/$cores)/1" | bc # >> cpuUtilBash.txt 26 # - Bandwidth Consumption 27 echo -n "Outbound BW (bits): "$'\t' 28 outbound1=$(awk -v interface="$interface" -F'[: \t]+' \ 29 '{ sub(/^ */,""); 30 if ($1 == interface) print $10; 31 }' /proc/net/dev) Solution: Note that this implementation has problems. First, the original script used the 1 minute avg field in /proc/loadavg … it should use the second field (5 minute avg). Second, we need to be precise in describing what we actually want to monitor. The loadavg assesses the demand for not only the CPU but also for I/O by the count of both types of processes waiting on system resources. In general, this should be divided by the number of total CPU cores to get an average across all CPUs. This is different from a CPU utilization which counts the relative amount of time the CPU is busy (versus idle). This measure is more of a result of the OS scheduling – assessing the % of time the CPUs are busy. The measure is the ratio of the number of scheduling intervals that were allocated to a process to the total number of intervals in the measurement period. If a CPU in an interval is not allocated, it is ‘idle’. The measure can be per CPU/Core or it can be the avg for all cores. The ‘5 minute load CPU utilization ‘ is based a piece of information available in the /proc/load. A ‘cat /proc/load /proc/stat’ on my VM shows: /proc/load 0.08 0.04 0.00 1/413 4071 /proc/stat: cpu 14468 150 17920 5610958 594 0 268 0 0 0 cpu0 5913 135 7698 2806934 183 0 121 0 0 0 cpu1 8555 15 10222 2804024 410 0 146 0 0 0 intr 4782837 36 8466 0 0 0 0 0 0 0 0 0 0 1004 0 0 28013 14238 19425 2 0 46538 25509 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ctxt 14984512 btime 1488540624 processes 4070 procs_running 2 procs_blocked 0 softirq 1113111 3 419335 7264 34027 37660 0 8486 419336 0 187000 A ‘man proc’ explains /proc/loadavg as follows: The first three fields in this file are load average figures giving the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 1, 5, and 15 minutes.
Recommended publications
  • Linux Commands Cheat Sheet
    LINUX COMMANDS CHEAT SHEET System File Permission uname => Displays Linux system information chmod octal filename => Change file permissions of the file to octal uname -r => Displays kernel release information Example uptime => Displays how long the system has been running including chmod 777 /data/test.c => Set rwx permissions to owner, group and everyone (every- load average one else who has access to the server) hostname => Shows the system hostname chmod 755 /data/test.c => Set rwx to the owner and r_x to group and everyone hostname -i => Displays the IP address of the system chmod 766 /data/test.c => Sets rwx for owner, rw for group and everyone last reboot => Shows system reboot history chown owner user-file => Change ownership of the file date => Displays current system date and time chown owner-user: owner-group => Change owner and group owner of the file timedatectl => Query and change the System clock file_name chown owner-user:owner-group- => Change owner and group owner of the directory cal => Displays the current calendar month and day directory w => Displays currently logged in users in the system whoami => Displays who you are logged in as Network finger username => Displays information about the user ip addr show => Displays IP addresses and all the network interfaces Hardware ip address add => Assigns IP address 192.168.0.1 to interface eth0 192.168.0.1/24 dev eth0 dmesg => Displays bootup messages ifconfig => Displays IP addresses of all network interfaces cat /proc/cpuinfo => Displays more information about CPU e.g model, model name, cores, vendor id ping host => ping command sends an ICMP echo request to establish a connection to server / PC cat /proc/meminfo => Displays more information about hardware memory e.g.
    [Show full text]
  • Chapter 19 RECOVERING DIGITAL EVIDENCE from LINUX SYSTEMS
    Chapter 19 RECOVERING DIGITAL EVIDENCE FROM LINUX SYSTEMS Philip Craiger Abstract As Linux-kernel-based operating systems proliferate there will be an in­ evitable increase in Linux systems that law enforcement agents must process in criminal investigations. The skills and expertise required to recover evidence from Microsoft-Windows-based systems do not neces­ sarily translate to Linux systems. This paper discusses digital forensic procedures for recovering evidence from Linux systems. In particular, it presents methods for identifying and recovering deleted files from disk and volatile memory, identifying notable and Trojan files, finding hidden files, and finding files with renamed extensions. All the procedures are accomplished using Linux command line utilities and require no special or commercial tools. Keywords: Digital evidence, Linux system forensics !• Introduction Linux systems will be increasingly encountered at crime scenes as Linux increases in popularity, particularly as the OS of choice for servers. The skills and expertise required to recover evidence from a Microsoft- Windows-based system, however, do not necessarily translate to the same tasks on a Linux system. For instance, the Microsoft NTFS, FAT, and Linux EXT2/3 file systems work differently enough that under­ standing one tells httle about how the other functions. In this paper we demonstrate digital forensics procedures for Linux systems using Linux command line utilities. The ability to gather evidence from a running system is particularly important as evidence in RAM may be lost if a forensics first responder does not prioritize the collection of live evidence. The forensic procedures discussed include methods for identifying and recovering deleted files from RAM and magnetic media, identifying no- 234 ADVANCES IN DIGITAL FORENSICS tables files and Trojans, and finding hidden files and renamed files (files with renamed extensions.
    [Show full text]
  • “Linux at the Command Line” Don Johnson of BU IS&T  We’Ll Start with a Sign in Sheet
    “Linux at the Command Line” Don Johnson of BU IS&T We’ll start with a sign in sheet. We’ll end with a class evaluation. We’ll cover as much as we can in the time allowed; if we don’t cover everything, you’ll pick it up as you continue working with Linux. This is a hands-on, lab class; ask questions at any time. Commands for you to type are in BOLD The Most Common O/S Used By BU Researchers When Working on a Server or Computer Cluster Linux is a Unix clone begun in 1991 and written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. 64% of the world’s servers run some variant of Unix or Linux. The Android phone and the Kindle run Linux. a set of small Linux is an O/S core programs written by written by Linus Richard Stallman and Torvalds and others others. They are the AND GNU utilities. http://www.gnu.org/ Network: ssh, scp Shells: BASH, TCSH, clear, history, chsh, echo, set, setenv, xargs System Information: w, whoami, man, info, which, free, echo, date, cal, df, free Command Information: man, info Symbols: |, >, >>, <, ;, ~, ., .. Filters: grep, egrep, more, less, head, tail Hotkeys: <ctrl><c>, <ctrl><d> File System: ls, mkdir, cd, pwd, mv, touch, file, find, diff, cmp, du, chmod, find File Editors: gedit, nedit You need a “xterm” emulation – software that emulates an “X” terminal and that connects using the “SSH” Secure Shell protocol. ◦ Windows Use StarNet “X-Win32:” http://www.bu.edu/tech/support/desktop/ distribution/xwindows/xwin32/ ◦ Mac OS X “Terminal” is already installed Why? Darwin, the system on which Apple's Mac OS X is built, is a derivative of 4.4BSD-Lite2 and FreeBSD.
    [Show full text]
  • The Linux Command Line
    The Linux Command Line Fifth Internet Edition William Shotts A LinuxCommand.org Book Copyright ©2008-2019, William E. Shotts, Jr. This work is licensed under the Creative Commons Attribution-Noncommercial-No De- rivative Works 3.0 United States License. To view a copy of this license, visit the link above or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042. A version of this book is also available in printed form, published by No Starch Press. Copies may be purchased wherever fine books are sold. No Starch Press also offers elec- tronic formats for popular e-readers. They can be reached at: https://www.nostarch.com. Linux® is the registered trademark of Linus Torvalds. All other trademarks belong to their respective owners. This book is part of the LinuxCommand.org project, a site for Linux education and advo- cacy devoted to helping users of legacy operating systems migrate into the future. You may contact the LinuxCommand.org project at http://linuxcommand.org. Release History Version Date Description 19.01A January 28, 2019 Fifth Internet Edition (Corrected TOC) 19.01 January 17, 2019 Fifth Internet Edition. 17.10 October 19, 2017 Fourth Internet Edition. 16.07 July 28, 2016 Third Internet Edition. 13.07 July 6, 2013 Second Internet Edition. 09.12 December 14, 2009 First Internet Edition. Table of Contents Introduction....................................................................................................xvi Why Use the Command Line?......................................................................................xvi
    [Show full text]
  • Configuration and Administration of Networking for Fedora 23
    Fedora 23 Networking Guide Configuration and Administration of Networking for Fedora 23 Stephen Wadeley Networking Guide Draft Fedora 23 Networking Guide Configuration and Administration of Networking for Fedora 23 Edition 1.0 Author Stephen Wadeley [email protected] Copyright © 2015 Red Hat, Inc. and others. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. The original authors of this document, and Red Hat, designate the Fedora Project as the "Attribution Party" for purposes of CC-BY-SA. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. For guidelines on the permitted uses of the Fedora trademarks, refer to https://fedoraproject.org/wiki/ Legal:Trademark_guidelines. Linux® is the registered trademark of Linus Torvalds in the United States and other countries. Java® is a registered trademark of Oracle and/or its affiliates. XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
    [Show full text]
  • Arxiv:1802.08979V2 [Cs.CL] 2 Mar 2018 Parsing Benchmarks (Dahl Et Al., 1994; Popescu Et Al., 2003)
    NL2Bash: A Corpus and Semantic Parser for Natural Language Interface to the Linux Operating System Xi Victoria Lin*, Chenglong Wang, Luke Zettlemoyer, Michael D. Ernst Salesforce Research, University of Washington, University of Washington, University of Washington [email protected], fclwang,lsz,[email protected] Abstract We present new data and semantic parsing methods for the problem of mapping English sentences to Bash commands (NL2Bash). Our long-term goal is to enable any user to perform operations such as file manipulation, search, and application-specific scripting by simply stating their goals in English. We take a first step in this domain, by providing a new dataset of challenging but commonly used Bash commands and expert-written English descriptions, along with baseline methods to establish performance levels on this task. Keywords: Natural Language Programming, Natural Language Interface, Semantic Parsing 1. Introduction We constructed the NL2Bash corpus with frequently used The dream of using English or any other natural language Bash commands scraped from websites such as question- to program computers has existed for almost as long as answering forums, tutorials, tech blogs, and course materi- the task of programming itself (Sammet, 1966). Although als. We gathered a set of high-quality descriptions of the significantly less precise than a formal language (Dijkstra, commands from Bash programmers. Table 1 shows several 1978), natural language as a programming medium would examples. After careful quality control, we were able to be universally accessible and would support the automation gather over 9,000 English-command pairs, covering over of highly repetitive tasks such as file manipulation, search, 100 unique Bash utilities.
    [Show full text]
  • Scripting in Axis Network Cameras and Video Servers
    Scripting in Axis Network Cameras and Video Servers Table of Contents 1 INTRODUCTION .............................................................................................................5 2 EMBEDDED SCRIPTS ....................................................................................................6 2.1 PHP .....................................................................................................................................6 2.2 SHELL ..................................................................................................................................7 3 USING SCRIPTS IN AXIS CAMERA/VIDEO PRODUCTS ......................................8 3.1 UPLOADING SCRIPTS TO THE CAMERA/VIDEO SERVER:...................................................8 3.2 RUNNING SCRIPTS WITH THE TASK SCHEDULER...............................................................8 3.2.1 Syntax for /etc/task.list.....................................................................................................9 3.3 RUNNING SCRIPTS VIA A WEB SERVER..............................................................................11 3.3.1 To enable Telnet support ...............................................................................................12 3.4 INCLUDED HELPER APPLICATIONS ..................................................................................13 3.4.1 The image buffer - bufferd........................................................................................13 3.4.2 sftpclient.........................................................................................................................16
    [Show full text]
  • Subcontractors – Bc, Xargs, Find
    Subcontractors – bc , xargs , find David Morgan © David Morgan 2011- 14 bc – math help for the shell interactive or programatic can accept its commands from stdin can accept an entire bc program’s worth © David Morgan 2011-14 1 bc – math help for shell bc, commanded interactively by user does what shell cannot e.g. high-precision math ( & much more ) bc, commanded non-interactively by shell shell, by extension, does high-precision can embed bc code wholesale as here document © David Morgan 2011-14 bc – shell script or bc interpreter script © David Morgan 2011-14 2 bc – math help for shell bc code, not bash shell code background: http://jeremykun.com/tag/simpsons-rule http://www.zweigmedia.com/RealWorld/integral/integral.html © David Morgan correct! 2011-14 bc – interactive math help for shell Wicked Cool Shell Scripts , Dave Taylor, p29 © David Morgan 2011-14 3 xargs produce list of vi’s backup files long list ‘em with xargs remove ‘em with xargs gone © David Morgan 2011-14 xargs filename too long to type command to avoid typing it what’s in the file? …oops cat needs filename as argument, not input xargs composes correct cat syntax by pasting its input onto cat’s command line produces: cat /root/class… etc etc produces: cat /etc/resolv.conf /root/class… etc etc xargs composes incorrect cp syntax by pasting its input onto cp’s command line produces: cp . /root/class… etc etc cp differs from cat, needs insertion from xargs not pasting control argument placement with xargs’ –I (xargs stuff goes where the special© char David appears, _ in this case) Morgan 2011-14 4 xargs and efficiency sleeptime totals 15 sec run sleeps simultaneously took 15 sec took 5 sec significant for compute-heavy commands distributes them across multi-cores – simultaneous execution © David Morgan 2011-14 xargs and efficiency commonly used with find to process files functionally equivalent – find .
    [Show full text]
  • $ Who Am I Mumbo Jumbo?
    Unix Crash Course Subjects (after lunch) ● Networking and the X windowing system ● Shell scripting concepts ● Regular expressions ● sed and awk ● Miscelanious (editing and programming) Unix Crash Course Slide 1 Unix Crash Course Slide 4 $ who am i Mumbo Jumbo? ● Rob Wolfram ● Unix System administrator ● E-mail: [email protected] ● PGP Key: 0xF7A0F7A0 Unix Crash Course Slide 2 Unix Crash Course Slide 5 Subjects (before lunch) Unix History ● A short history of Unix and Linux ● AT&T abandoned MULTICS ● Structure and philosophy of Unix ● Ken Thompson & Dennis Ritchie developed UNICS on a PDP7 ● Files and filesystems ● UNIX ported to Ritchie's C language ● Shell variables and globbing ● BSD released, many ports followed ● Processes and jobs ● POSIX effort to unify Unices ● GNU project / Linux kernel Unix Crash Course Slide 3 Unix Crash Course Slide 6 Unix History Unix philosophy ● Everything is a file ● Combine small tools to build your requirement Ritchie and Thompson working on a PDP11/20 at Bell Labs Unix Crash Course Slide 7 Unix Crash Course Slide 10 Unix History Unix structure Unix has an onion-like structure, the hardware is handled by the kernel Unix Crash Course Slide 8 Unix Crash Course Slide 11 (Gnu/) Linux distros Kernel provisions The kernel provides: ● CPU scheduling of processes ● Accessing hardware ● System calls for user-land programs ● The filesystem ● Privilege separation etc. Unix Crash Course Slide 9 Unix Crash Course Slide 12 Multi-user environment File permissions ● Unix runs programs from multiple users concurrently,
    [Show full text]
  • USER MANUAL GWR High Speed Cellular Router Series
    GWR USER MANUAL GWR High Speed Cellular Router Series Document version 1.0.0 Date: December 2015 WWW.GENEKO.RS User Manual Document History Date Description Author Comments 24.12.2015 User Manual Tanja Savić Firmware versions: 1.1.2 Document Approval The following report has been accepted and approved by the following: Signature Printed Name Title Date Dragan Marković Executive Director 24.12.2015 GWR High Speed Cellular Router Series 2 User Manual Content DOCUMENT APPROVAL ........................................................................................................................................ 2 LIST OF FIGURES .................................................................................................................................................... 5 LIST OF TABLES ...................................................................................................................................................... 8 DESCRIPTION OF THE GPRS/EDGE/HSPA ROUTER SERIES ...................................................................... 9 TYPICAL APPLICATION ............................................................................................................................... 10 TECHNICAL PARAMETERS ......................................................................................................................... 11 PROTOCOLS AND FEATURES ...................................................................................................................... 14 PRODUCT OVERVIEW ...............................................................................................................................
    [Show full text]
  • GNU Findutils Finding Files Version 4.8.0, 7 January 2021
    GNU Findutils Finding files version 4.8.0, 7 January 2021 by David MacKenzie and James Youngman This manual documents version 4.8.0 of the GNU utilities for finding files that match certain criteria and performing various operations on them. Copyright c 1994{2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". i Table of Contents 1 Introduction ::::::::::::::::::::::::::::::::::::: 1 1.1 Scope :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 1 1.2 Overview ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 2 2 Finding Files ::::::::::::::::::::::::::::::::::::: 4 2.1 find Expressions ::::::::::::::::::::::::::::::::::::::::::::::: 4 2.2 Name :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 4 2.2.1 Base Name Patterns ::::::::::::::::::::::::::::::::::::::: 5 2.2.2 Full Name Patterns :::::::::::::::::::::::::::::::::::::::: 5 2.2.3 Fast Full Name Search ::::::::::::::::::::::::::::::::::::: 7 2.2.4 Shell Pattern Matching :::::::::::::::::::::::::::::::::::: 8 2.3 Links ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 8 2.3.1 Symbolic Links :::::::::::::::::::::::::::::::::::::::::::: 8 2.3.2 Hard Links ::::::::::::::::::::::::::::::::::::::::::::::: 10 2.4 Time
    [Show full text]
  • SYSTEM INFORMATION Hostname Internet (IP) Address Ethernet Address Hub and Port Numbers Emergency Contact Person Boot Command Di
    SYSTEM INFORMATION COMMON COMMAND EXAMPLES TOKENS USED IN SENDMAIL.CF Hostname ifconfig plumb # Solaris: probe for network interfaces Token Debug Meaning ifconfig lo0 127.0.0.1 up # Loopback interface ifconfig en0 inet 128.130.240.1 up netmask $@ Match zero tokens (V8 only) 0xFFFFFF00 broadcast 128.130.240.255 $- ^R Match exactly one token $+ ^Q Match one or more tokens Internet (IP) address route add net 128.130.138.0 128.130.240.12 1 $* ^P Match zero or more tokens route add default 128.130.240.12 1 $X Match value of macro variable X # BSD/OS and OSF/1 use –net and –host and no metric $&X Match value of X at run time route add –net 128.130.138.0 128.130.240.12 $=X ^SX Match any token in class X Ethernet address route add default 128.130.240.12 $~X ^TX Match any token not in class X netstat –rn # Routing table (numeric addresses) The Debug column shows the tokens as they will be printed netstat – en0 5 # Monitor en0 at 5-second intervals by sendmail in address test mode (sendmail -bt). netstat –in # Interfaces (numeric addresses) Hub and port numbers dump 0uf /dev/nrst0 /users # Level 0 dump DNS RECORD TYPES dump 0f – /usr | (cd /mnt; restore rvf –) # Copy tar cf – ./from | (cd todir; tar xvfp –) # Copy dir Type Syntax Emergency contact person # Find object files larger than 1MB not accessed in a year SOA zone [ttl] IN SOA primary admin serial find /users –type f –name "*.o" –size +1048576c refresh retry expire min –atime +365 –print NS zone [ttl] IN NS host # List all C source files sorted by number of lines A hostname [ttl] IN A ipaddr PTR ipaddr [ttl] IN PTR hostname Boot command find .
    [Show full text]