_EXIT(2) Linux Programmer's Manual _EXIT(2) NNAAMMEE _exit, _Exit - terminate the current process SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd __eexxiitt((iinntt _s_t_a_t_u_s));; ##iinncclluuddee <> vvooiidd __EExxiitt((iinntt _s_t_a_t_u_s));; DDEESSCCRRIIPPTTIIOONN The function __eexxiitt terminates the calling process "immedi- ately". Any open file descriptors belonging to the process are closed; any children of the process are inherited by process 1, init, and the process's parent is sent a SSIIGGCCHHLLDD signal. The value _s_t_a_t_u_s is returned to the parent process as the process's exit status, and can be collected using one of ACCEPT(2) Linux Programmer's Manual ACCEPT(2) NNAAMMEE accept - accept a connection on a socket SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt aacccceepptt((iinntt _s,, ssttrruucctt ssoocckkaaddddrr **_a_d_d_r,, ssoocckklleenn__tt **_a_d_d_r_l_e_n));; DDEESSCCRRIIPPTTIIOONN The aacccceepptt function is used with connection-based socket types (SSOOCCKK__SSTTRREEAAMM, SSOOCCKK__SSEEQQPPAACCKKEETT and SSOOCCKK__RRDDMM). It extracts the first connection request on the queue of pending connections, creates a new connected socket with mostly the same properties as _s, and allocates a new file descriptor for the socket, which is returned. The newly created socket is no longer in the listening state. The original socket _s is unaffected by this call. Note that any per file descriptor flags (everything that can be set with the FF__SSEETTFFLL fcntl, like non blocking or async state) ACCESS(2) Linux Programmer's Manual ACCESS(2) NNAAMMEE access - check user's permissions for a file SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt aacccceessss((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e,, iinntt _m_o_d_e));; DDEESSCCRRIIPPTTIIOONN aacccceessss checks whether the process would be allowed to read, write or test for existence of the file (or other file system object) whose name is _p_a_t_h_n_a_m_e. If _p_a_t_h_n_a_m_e is a symbolic link permissions of the file referred to by this symbolic link are tested. _m_o_d_e is a mask consisting of one or more of RR__OOKK, WW__OOKK, XX__OOKK and FF__OOKK. RR__OOKK, WW__OOKK and XX__OOKK request checking whether the file exists and has read, write and execute permissions, respectively. FF__OOKK just requests checking for the exis- ALARM(2) Linux Programmer's Manual ALARM(2) NNAAMMEE alarm - set an alarm clock for delivery of a signal SSYYNNOOPPSSIISS ##iinncclluuddee <> uunnssiiggnneedd iinntt aallaarrmm((uunnssiiggnneedd iinntt _s_e_c_o_n_d_s));; DDEESSCCRRIIPPTTIIOONN aallaarrmm arranges for a SSIIGGAALLRRMM signal to be delivered to the process in _s_e_c_o_n_d_s seconds. If _s_e_c_o_n_d_s is zero, no new aallaarrmm is scheduled. In any event any previously set aallaarrmm is cancelled. RREETTUURRNN VVAALLUUEE aallaarrmm returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm. BIND(2) Linux Programmer's Manual BIND(2) NNAAMMEE bind - bind a name to a socket SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt bbiinndd((iinntt _s_o_c_k_f_d,, ssttrruucctt ssoocckkaaddddrr **_m_y___a_d_d_r,, ssoocckklleenn__tt _a_d_d_r_l_e_n));; DDEESSCCRRIIPPTTIIOONN bbiinndd gives the socket _s_o_c_k_f_d the local address _m_y___a_d_d_r. _m_y___a_d_d_r is _a_d_d_r_l_e_n bytes long. Traditionally, this is called "assigning a name to a socket." When a socket is created with ssoocckkeett(2), it exists in a name space (address family) but has no name assigned. It is normally necessary to assign a local address using bbiinndd before a SSOOCCKK__SSTTRREEAAMM socket may receive connections (see aacccceepptt(2)). CHDIR(2) Linux Programmer's Manual CHDIR(2) NNAAMMEE chdir, fchdir - change working directory SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt cchhddiirr((ccoonnsstt cchhaarr **_p_a_t_h));; iinntt ffcchhddiirr((iinntt _f_d));; DDEESSCCRRIIPPTTIIOONN cchhddiirr changes the current directory to that specified in _p_a_t_h. ffcchhddiirr is identical to cchhddiirr, only that the directory is given as an open file descriptor. RREETTUURRNN VVAALLUUEE On success, zero is returned. On error, -1 is returned, and _e_r_r_n_o is set appropriately. EERRRROORRSS CHMOD(2) Linux Programmer's Manual CHMOD(2) NNAAMMEE chmod, fchmod - change permissions of a file SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt cchhmmoodd((ccoonnsstt cchhaarr **_p_a_t_h,, mmooddee__tt _m_o_d_e));; iinntt ffcchhmmoodd((iinntt _f_i_l_d_e_s,, mmooddee__tt _m_o_d_e));; DDEESSCCRRIIPPTTIIOONN The mode of the file given by _p_a_t_h or referenced by _f_i_l_d_e_s is changed. Modes are specified by _o_r_'_i_n_g the following: S_ISUID 04000 set user ID on execution S_ISGID 02000 set group ID on execution CHOWN(2) Linux Programmer's Manual CHOWN(2) NNAAMMEE chown, fchown, lchown - change ownership of a file SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt cchhoowwnn((ccoonnsstt cchhaarr **_p_a_t_h,, uuiidd__tt _o_w_n_e_r,, ggiidd__tt _g_r_o_u_p));; iinntt ffcchhoowwnn((iinntt _f_d,, uuiidd__tt _o_w_n_e_r,, ggiidd__tt _g_r_o_u_p));; iinntt llcchhoowwnn((ccoonnsstt cchhaarr **_p_a_t_h,, uuiidd__tt _o_w_n_e_r,, ggiidd__tt _g_r_o_u_p));; DDEESSCCRRIIPPTTIIOONN The owner of the file specified by _p_a_t_h or by _f_d is changed. Only the super-user may change the owner of a file. The owner of a file may change the group of the file to any group of which that owner is a member. The super-user may change the group arbitrarily. If the _o_w_n_e_r or _g_r_o_u_p is specified as -1, then that ID is not changed. CHROOT(2) Linux Programmer's Manual CHROOT(2) NNAAMMEE chroot - change root directory SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt cchhrroooott((ccoonnsstt cchhaarr **_p_a_t_h));; DDEESSCCRRIIPPTTIIOONN cchhrroooott changes the root directory to that specified in _p_a_t_h. This directory will be used for path names begin- ning with /. The root directory is inherited by all chil- dren of the current process. Only the super-user may change the root directory. Note that this call does not change the current working directory, so that `.' can be outside the tree rooted at `/'. In particular, the super-user can escape from a `chroot jail' by doing `mkdir foo; chroot foo; cd ..'. CLONE(2) Linux Programmer's Manual CLONE(2) NNAAMMEE clone - create a child process SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt cclloonnee((iinntt ((**_f_n))((vvooiidd **)),, vvooiidd **_c_h_i_l_d___s_t_a_c_k,, iinntt _f_l_a_g_s,, vvooiidd **_a_r_g));; __ssyyssccaallll22((iinntt,, _c_l_o_n_e,, iinntt,, _f_l_a_g_s,, vvooiidd **,, _c_h_i_l_d___s_t_a_c_k)) DDEESSCCRRIIPPTTIIOONN cclloonnee creates a new process, just like ffoorrkk(2). cclloonnee is a library function layered on top of the underlying cclloonnee system call, hereinafter referred to as ssyyss__cclloonnee. A description of ssyyss__cclloonnee is given towards the end of this page. Unlike ffoorrkk(2), these calls allow the child process to share parts of its execution context with the calling pro- CLOSE(2) Linux Programmer's Manual CLOSE(2) NNAAMMEE close - close a file descriptor SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt cclloossee((iinntt _f_d));; DDEESSCCRRIIPPTTIIOONN cclloossee closes a file descriptor, so that it no longer refers to any file and may be reused. Any locks held on the file it was associated with, and owned by the process, are removed (regardless of the file descriptor that was used to obtain the lock). If _f_d is the last copy of a particular file descriptor the resources associated with it are freed; if the descriptor was the last reference to a file which has been removed using uunnlliinnkk(2) the file is deleted. RREETTUURRNN VVAALLUUEE CONNECT(2) Linux Programmer's Manual CONNECT(2) NNAAMMEE connect - initiate a connection on a socket SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt ccoonnnneecctt((iinntt _s_o_c_k_f_d,, ccoonnsstt ssttrruucctt ssoocckkaaddddrr **_s_e_r_v___a_d_d_r,, ssoocckklleenn__tt _a_d_d_r_l_e_n));; DDEESSCCRRIIPPTTIIOONN The file descriptor _s_o_c_k_f_d must refer to a socket. If the socket is of type SSOOCCKK__DDGGRRAAMM then the _s_e_r_v___a_d_d_r address is the address to which datagrams are sent by default, and the only address from which datagrams are received. If the socket is of type SSOOCCKK__SSTTRREEAAMM or SSOOCCKK__SSEEQQPPAACCKKEETT, this call attempts to make a connection to another socket. The other socket is specified by _s_e_r_v___a_d_d_r, which is an address (of length _a_d_d_r_l_e_n) in the communications space of the socket. Each communications space interprets the _s_e_r_v___a_d_d_r parameter in its own way. OPEN(2) System calls OPEN(2) NNAAMMEE open, creat - open and possibly create a file or device SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ##iinncclluuddee <> iinntt ooppeenn((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e,, iinntt _f_l_a_g_s));; iinntt ooppeenn((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e,, iinntt _f_l_a_g_s,, mmooddee__tt _m_o_d_e));; iinntt ccrreeaatt((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e,, mmooddee__tt _m_o_d_e));; DDEESSCCRRIIPPTTIIOONN The ooppeenn(()) system call is used to convert a pathname into a file descriptor (a small, non-negative integer for use in subsequent I/O as with rreeaadd, wwrriittee, etc.). When the call is successful, the file descriptor returned will be the lowest file descriptor not currently open for the pro- cess. This call creates a new open file, not shared with any other process. (But shared open files may arise via the ffoorrkk(2) system call.) The new file descriptor is set DUP(2) Linux Programmer's Manual DUP(2) NNAAMMEE dup, dup2 - duplicate a file descriptor SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt dduupp((iinntt _o_l_d_f_d));; iinntt dduupp22((iinntt _o_l_d_f_d,, iinntt _n_e_w_f_d));; DDEESSCCRRIIPPTTIIOONN dduupp and dduupp22 create a copy of the file descriptor _o_l_d_f_d. After successful return of dduupp or dduupp22, the old and new descriptors may be used interchangeably. They share locks, file position pointers and flags; for example, if the file position is modified by using llsseeeekk on one of the descrip- tors, the position is also changed for the other. The two descriptors do not share the close-on-exec flag, however. DUP(2) Linux Programmer's Manual DUP(2) NNAAMMEE dup, dup2 - duplicate a file descriptor SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt dduupp((iinntt _o_l_d_f_d));; iinntt dduupp22((iinntt _o_l_d_f_d,, iinntt _n_e_w_f_d));; DDEESSCCRRIIPPTTIIOONN dduupp and dduupp22 create a copy of the file descriptor _o_l_d_f_d. After successful return of dduupp or dduupp22, the old and new descriptors may be used interchangeably. They share locks, file position pointers and flags; for example, if the file position is modified by using llsseeeekk on one of the descrip- tors, the position is also changed for the other. The two descriptors do not share the close-on-exec flag, however. EXECVE(2) Linux Programmer's Manual EXECVE(2) NNAAMMEE execve - execute program SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt eexxeeccvvee((ccoonnsstt cchhaarr **_f_i_l_e_n_a_m_e,, cchhaarr **ccoonnsstt _a_r_g_v [[]],, cchhaarr **ccoonnsstt _e_n_v_p[[]]));; DDEESSCCRRIIPPTTIIOONN eexxeeccvvee(()) executes the program pointed to by _f_i_l_e_n_a_m_e. _f_i_l_e_n_a_m_e must be either a binary executable, or a script starting with a line of the form "##!! _i_n_t_e_r_p_r_e_t_e_r [arg]". In the latter case, the interpreter must be a valid path- name for an executable which is not itself a script, which will be invoked as iinntteerrpprreetteerr [arg] _f_i_l_e_n_a_m_e. _a_r_g_v is an array of argument strings passed to the new program. _e_n_v_p is an array of strings, conventionally of the form kkeeyy==vvaalluuee, which are passed as environment to the new program. Both, _a_r_g_v and _e_n_v_p must be terminated by a _EXIT(2) Linux Programmer's Manual _EXIT(2) NNAAMMEE _exit, _Exit - terminate the current process SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd __eexxiitt((iinntt _s_t_a_t_u_s));; ##iinncclluuddee <> vvooiidd __EExxiitt((iinntt _s_t_a_t_u_s));; DDEESSCCRRIIPPTTIIOONN The function __eexxiitt terminates the calling process "immedi- ately". Any open file descriptors belonging to the process are closed; any children of the process are inherited by process 1, init, and the process's parent is sent a SSIIGGCCHHLLDD signal. The value _s_t_a_t_u_s is returned to the parent process as the process's exit status, and can be collected using one of FCNTL(2) Linux Programmer's Manual FCNTL(2) NNAAMMEE fcntl - manipulate file descriptor SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt ffccnnttll((iinntt _f_d,, iinntt _c_m_d));; iinntt ffccnnttll((iinntt _f_d,, iinntt _c_m_d,, lloonngg _a_r_g));; iinntt ffccnnttll((iinntt _f_d,, iinntt _c_m_d,, ssttrruucctt fflloocckk **_l_o_c_k));; DDEESSCCRRIIPPTTIIOONN ffccnnttll performs one of various miscellaneous operations on _f_d. The operation in question is determined by _c_m_d. HHaannddlliinngg cclloossee--oonn--eexxeecc FF__DDUUPPFFDD Find the lowest numbered available file descriptor greater than or equal to _a_r_g and make it be a copy of _f_d. This is different form dduupp22(2) which uses exactly the descriptor specified. FORK(2) Linux Programmer's Manual FORK(2) NNAAMMEE fork - create a child process SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ppiidd__tt ffoorrkk((vvooiidd));; DDEESSCCRRIIPPTTIIOONN ffoorrkk creates a child process that differs from the parent process only in its PID and PPID, and in the fact that resource utilizations are set to 0. File locks and pend- ing signals are not inherited. Under Linux, ffoorrkk is implemented using copy-on-write pages, so the only penalty incurred by fork is the time and memory required to duplicate the parent's page tables, and to create a unique task structure for the child. RREETTUURRNN VVAALLUUEE STAT(2) System calls STAT(2) NNAAMMEE stat, fstat, lstat - get file status SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ##iinncclluuddee <> iinntt ssttaatt((ccoonnsstt cchhaarr **_f_i_l_e___n_a_m_e,, ssttrruucctt ssttaatt **_b_u_f));; iinntt ffssttaatt((iinntt _f_i_l_e_d_e_s,, ssttrruucctt ssttaatt **_b_u_f));; iinntt llssttaatt((ccoonnsstt cchhaarr **_f_i_l_e___n_a_m_e,, ssttrruucctt ssttaatt **_b_u_f));; DDEESSCCRRIIPPTTIIOONN These functions return information about the specified file. You do not need any access rights to the file to get this information but you need search rights to all directories named in the path leading to the file. ssttaatt stats the file pointed to by _f_i_l_e___n_a_m_e and fills in _b_u_f. FSYNC(2) Linux Programmer's Manual FSYNC(2) NNAAMMEE fsync, fdatasync - synchronize a file's complete in-core state with that on disk SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ffssyynncc((iinntt _f_d));; iinntt ffddaattaassyynncc((iinntt _f_d));; DDEESSCCRRIIPPTTIIOONN ffssyynncc copies all in-core parts of a file to disk, and waits until the device reports that all parts are on sta- ble storage. It also updates metadata stat information. It does not necessarily ensure that the entry in the directory containing the file has also reached disk. For that an explicit ffssyynncc on the file descriptor of the directory is also needed. ffddaattaassyynncc does the same as ffssyynncc but only flushes user GETGID(2) Linux Programmer's Manual GETGID(2) NNAAMMEE getgid, getegid - get group identity SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ggiidd__tt ggeettggiidd((vvooiidd));; ggiidd__tt ggeetteeggiidd((vvooiidd));; DDEESSCCRRIIPPTTIIOONN ggeettggiidd returns the real group ID of the current process. ggeetteeggiidd returns the effective group ID of the current pro- cess. The real ID corresponds to the ID of the calling process. The effective ID corresponds to the set ID bit on the file being executed. EERRRROORRSS GETHOSTNAME(2) Linux Programmer's Manual GETHOSTNAME(2) NNAAMMEE gethostname, sethostname - get/set host name SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ggeetthhoossttnnaammee((cchhaarr **_n_a_m_e,, ssiizzee__tt _l_e_n));; iinntt sseetthhoossttnnaammee((ccoonnsstt cchhaarr **_n_a_m_e,, ssiizzee__tt _l_e_n));; DDEESSCCRRIIPPTTIIOONN These functions are used to access or to change the host name of the current processor. The ggeetthhoossttnnaammee(()) function returns a NUL-terminated hostname (set earlier by sseetthhoosstt-- nnaammee(())) in the array _n_a_m_e that has a length of _l_e_n bytes. In case the NUL-terminated hostname does not fit, no error is returned, but the hostname is truncated. It is unspeci- fied whether the truncated hostname will be NUL-termi- nated. RREETTUURRNN VVAALLUUEE On success, zero is returned. On error, -1 is returned, GETITIMER(2) Linux Programmer's Manual GETITIMER(2) NNAAMMEE getitimer, setitimer - get or set value of an interval timer SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ggeettiittiimmeerr((iinntt _w_h_i_c_h,, ssttrruucctt iittiimmeerrvvaall **_v_a_l_u_e));; iinntt sseettiittiimmeerr((iinntt _w_h_i_c_h,, ccoonnsstt ssttrruucctt iittiimmeerrvvaall **_v_a_l_u_e,, ssttrruucctt iittiimmeerrvvaall **_o_v_a_l_u_e));; DDEESSCCRRIIPPTTIIOONN The system provides each process with three interval timers, each decrementing in a distinct time domain. When any timer expires, a signal is sent to the process, and the timer (potentially) restarts. IITTIIMMEERR__RREEAALL decrements in real time, and delivers SSIIGGAALLRRMM upon expiration. IITTIIMMEERR__VVIIRRTTUUAALL decrements only when the process is execut- GETPID(2) Linux Programmer's Manual GETPID(2) NNAAMMEE getpid, getppid - get process identification SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ppiidd__tt ggeettppiidd((vvooiidd));; ppiidd__tt ggeettppppiidd((vvooiidd));; DDEESSCCRRIIPPTTIIOONN ggeettppiidd returns the process ID of the current process. (This is often used by routines that generate unique tem- porary file names.) ggeettppppiidd returns the process ID of the parent of the cur- rent process. CCOONNFFOORRMMIINNGG TTOO POSIX, BSD 4.3, SVID GETPRIORITY(2) Linux Programmer's Manual GETPRIORITY(2) NNAAMMEE getpriority, setpriority - get/set program scheduling pri- ority SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt ggeettpprriioorriittyy((iinntt _w_h_i_c_h,, iinntt _w_h_o));; iinntt sseettpprriioorriittyy((iinntt _w_h_i_c_h,, iinntt _w_h_o,, iinntt _p_r_i_o));; DDEESSCCRRIIPPTTIIOONN The scheduling priority of the process, process group, or user, as indicated by _w_h_i_c_h and _w_h_o is obtained with the ggeettpprriioorriittyy call and set with the sseettpprriioorriittyy call. _W_h_i_c_h is one of PPRRIIOO__PPRROOCCEESSSS, PPRRIIOO__PPGGRRPP, or PPRRIIOO__UUSSEERR, and _w_h_o is interpreted relative to _w_h_i_c_h (a process identifier for PPRRIIOO__PPRROOCCEESSSS, process group identifier for PPRRIIOO__PPGGRRPP, and a user ID for PPRRIIOO__UUSSEERR). A zero value for _w_h_o denotes (respectively) the calling process, the process group of the calling process, or the real user ID of the calling GETTIMEOFDAY(2) Linux Programmer's Manual GETTIMEOFDAY(2) NNAAMMEE gettimeofday, settimeofday - get / set time SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ggeettttiimmeeooffddaayy((ssttrruucctt ttiimmeevvaall **_t_v,, ssttrruucctt ttiimmeezzoonnee **_t_z));; iinntt sseettttiimmeeooffddaayy((ccoonnsstt ssttrruucctt ttiimmeevvaall **_t_v ,, ccoonnsstt ssttrruucctt ttiimmeezzoonnee **_t_z));; DDEESSCCRRIIPPTTIIOONN The functions ggeettttiimmeeooffddaayy and sseettttiimmeeooffddaayy can get and set the time as well as a timezone. The _t_v argument is a ttiimmeevvaall struct, as specified in : struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* microseconds */ }; and gives the number of seconds and microseconds since the GETUID(2) Linux Programmer's Manual GETUID(2) NNAAMMEE getuid, geteuid - get user identity SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> uuiidd__tt ggeettuuiidd((vvooiidd));; uuiidd__tt ggeetteeuuiidd((vvooiidd));; DDEESSCCRRIIPPTTIIOONN ggeettuuiidd returns the real user ID of the current process. ggeetteeuuiidd returns the effective user ID of the current pro- cess. The real ID corresponds to the ID of the calling process. The effective ID corresponds to the set ID bit on the file being executed. EERRRROORRSS GETXATTR(2) System calls GETXATTR(2) NNAAMMEE getxattr, lgetxattr, fgetxattr - retrieve an extended attribute value SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ssssiizzee__tt ggeettxxaattttrr ((ccoonnsstt cchhaarr **_p_a_t_h,, ccoonnsstt cchhaarr **_n_a_m_e,, vvooiidd **_v_a_l_u_e,, ssiizzee__tt _s_i_z_e));; ssssiizzee__tt llggeettxxaattttrr ((ccoonnsstt cchhaarr **_p_a_t_h,, ccoonnsstt cchhaarr **_n_a_m_e,, vvooiidd **_v_a_l_u_e,, ssiizzee__tt _s_i_z_e));; ssssiizzee__tt ffggeettxxaattttrr ((iinntt _f_i_l_e_d_e_s,, ccoonnsstt cchhaarr **_n_a_m_e,, vvooiidd **_v_a_l_u_e,, ssiizzee__tt _s_i_z_e));; DDEESSCCRRIIPPTTIIOONN Extended attributes are _n_a_m_e:_v_a_l_u_e pairs associated with inodes (files, directories, symlinks, etc). They are extensions to the normal attributes which are associated with all inodes in the system (i.e. the ssttaatt(2) data). A complete overview of extended attributes concepts can be UNIMPLEMENTED(2) Linux Programmer's Manual UNIMPLEMENTED(2) NNAAMMEE afs_syscall, break, ftime, getpmsg, gtty, lock, mpx, prof, profil, putpmsg, security, stty, ulimit - unimplemented system calls SSYYNNOOPPSSIISS Unimplemented system calls. DDEESSCCRRIIPPTTIIOONN These system calls are not implemented in the Linux 2.4 kernel. RREETTUURRNN VVAALLUUEE These system calls always return -1 and set _e_r_r_n_o to EENNOOSSYYSS. NNOOTTEESS Note that _f_t_i_m_e(3), _p_r_o_f_i_l(3) and _u_l_i_m_i_t(3) are imple- mented as library functions. Some system calls, like _a_l_l_o_c___h_u_g_e_p_a_g_e_s(2), IOCTL(2) Linux Programmer's Manual IOCTL(2) NNAAMMEE ioctl - control device SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt iiooccttll((iinntt _d,, iinntt _r_e_q_u_e_s_t,, ......));; DDEESSCCRRIIPPTTIIOONN The iiooccttll function manipulates the underlying device parameters of special files. In particular, many operat- ing characteristics of character special files (e.g. ter- minals) may be controlled with iiooccttll requests. The argu- ment _d must be an open file descriptor. The second argument is a device-dependent request code. The third argument is an untyped pointer to memory. It's traditionally cchhaarr **_a_r_g_p (from the days before vvooiidd ** was valid C), and will be so named for this discussion. An ioctl _r_e_q_u_e_s_t has encoded in it whether the argument is IOCTL_LIST(2) Linux Programmer's Manual IOCTL_LIST(2) NNAAMMEE ioctl_list - list of ioctl calls in Linux/i386 kernel DDEESSCCRRIIPPTTIIOONN This is Ioctl List 1.3.27, a list of ioctl calls in Linux/i386 kernel 1.3.27. It contains 421 ioctls from /usr/include/{asm,linux}/*.h. For each ioctl, its numeri- cal value, its name, and its argument type are given. An argument type of 'const struct foo *' means the argu- ment is input to the kernel. 'struct foo *' means the kernel outputs the argument. If the kernel uses the argu- ment for both input and output, this is marked with // I- O. Some ioctls take more arguments or return more values than a single structure. These are marked // MORE and docu- mented further in a separate section. This list is very incomplete. Please e-mail changes and KILL(2) Linux Programmer's Manual KILL(2) NNAAMMEE kill - send signal to a process SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt kkiillll((ppiidd__tt _p_i_d,, iinntt _s_i_g));; DDEESSCCRRIIPPTTIIOONN The kkiillll system call can be used to send any signal to any process group or process. If _p_i_d is positive, then signal _s_i_g is sent to _p_i_d. If _p_i_d equals 0, then _s_i_g is sent to every process in the process group of the current process. If _p_i_d equals -1, then _s_i_g is sent to every process except for process 1 (init), but see below. LINK(2) Linux Programmer's Manual LINK(2) NNAAMMEE link - make a new name for a file SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt lliinnkk((ccoonnsstt cchhaarr **_o_l_d_p_a_t_h,, ccoonnsstt cchhaarr **_n_e_w_p_a_t_h));; DDEESSCCRRIIPPTTIIOONN lliinnkk creates a new link (also known as a hard link) to an existing file. If _n_e_w_p_a_t_h exists it will _n_o_t be overwritten. This new name may be used exactly as the old one for any operation; both names refer to the same file (and so have the same permissions and ownership) and it is impossible to tell which name was the `original'. RREETTUURRNN VVAALLUUEE On success, zero is returned. On error, -1 is returned, UNIMPLEMENTED(2) Linux Programmer's Manual UNIMPLEMENTED(2) NNAAMMEE afs_syscall, break, ftime, getpmsg, gtty, lock, mpx, prof, profil, putpmsg, security, stty, ulimit - unimplemented system calls SSYYNNOOPPSSIISS Unimplemented system calls. DDEESSCCRRIIPPTTIIOONN These system calls are not implemented in the Linux 2.4 kernel. RREETTUURRNN VVAALLUUEE These system calls always return -1 and set _e_r_r_n_o to EENNOOSSYYSS. NNOOTTEESS Note that _f_t_i_m_e(3), _p_r_o_f_i_l(3) and _u_l_i_m_i_t(3) are imple- mented as library functions. Some system calls, like _a_l_l_o_c___h_u_g_e_p_a_g_e_s(2), LSEEK(2) System calls LSEEK(2) NNAAMMEE lseek - reposition read/write file offset SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ooffff__tt llsseeeekk((iinntt _f_i_l_d_e_s,, ooffff__tt _o_f_f_s_e_t,, iinntt _w_h_e_n_c_e));; DDEESSCCRRIIPPTTIIOONN The llsseeeekk function repositions the offset of the file descriptor _f_i_l_d_e_s to the argument _o_f_f_s_e_t according to the directive _w_h_e_n_c_e as follows: SSEEEEKK__SSEETT The offset is set to _o_f_f_s_e_t bytes. SSEEEEKK__CCUURR The offset is set to its current location plus _o_f_f_- _s_e_t bytes. STAT(2) System calls STAT(2) NNAAMMEE stat, fstat, lstat - get file status SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ##iinncclluuddee <> iinntt ssttaatt((ccoonnsstt cchhaarr **_f_i_l_e___n_a_m_e,, ssttrruucctt ssttaatt **_b_u_f));; iinntt ffssttaatt((iinntt _f_i_l_e_d_e_s,, ssttrruucctt ssttaatt **_b_u_f));; iinntt llssttaatt((ccoonnsstt cchhaarr **_f_i_l_e___n_a_m_e,, ssttrruucctt ssttaatt **_b_u_f));; DDEESSCCRRIIPPTTIIOONN These functions return information about the specified file. You do not need any access rights to the file to get this information but you need search rights to all directories named in the path leading to the file. ssttaatt stats the file pointed to by _f_i_l_e___n_a_m_e and fills in _b_u_f. MKDIR(2) Linux Programmer's Manual MKDIR(2) NNAAMMEE mkdir - create a directory SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt mmkkddiirr((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e,, mmooddee__tt _m_o_d_e));; DDEESSCCRRIIPPTTIIOONN mmkkddiirr attempts to create a directory named _p_a_t_h_n_a_m_e. _m_o_d_e specifies the permissions to use. It is modified by the process's uummaasskk in the usual way: the permissions of the created file are ((mmooddee && ~~uummaasskk)). The newly created directory will be owned by the effective uid of the process. If the directory containing the file has the set group id bit set, or if the filesystem is mounted with BSD group semantics, the new directory will inherit the group ownership from its parent; otherwise it NANOSLEEP(2) Linux Programmer's Manual NANOSLEEP(2) NNAAMMEE nanosleep - pause execution for a specified time SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt nnaannoosslleeeepp((ccoonnsstt ssttrruucctt ttiimmeessppeecc **_r_e_q,, ssttrruucctt ttiimmeessppeecc **_r_e_m));; DDEESSCCRRIIPPTTIIOONN nnaannoosslleeeepp delays the execution of the program for at least the time specified in _*_r_e_q. The function can return ear- lier if a signal has been delivered to the process. In this case, it returns -1, sets _e_r_r_n_o to EEIINNTTRR, and writes the remaining time into the structure pointed to by _r_e_m unless _r_e_m is NNUULLLL. The value of _*_r_e_m can then be used to call nnaannoosslleeeepp again and complete the specified pause. The structure _t_i_m_e_s_p_e_c is used to specify intervals of time with nanosecond precision. It is specified in _<_t_i_m_e_._h_> and has the form NICE(2) Linux Programmer's Manual NICE(2) NNAAMMEE nice - change process priority SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt nniiccee((iinntt _i_n_c));; DDEESSCCRRIIPPTTIIOONN nniiccee adds _i_n_c to the nice value for the calling pid. (A large nice value means a low priority.) Only the super- user may specify a negative increment, or priority increase. RREETTUURRNN VVAALLUUEE On success, zero is returned. On error, -1 is returned, and _e_r_r_n_o is set appropriately. EERRRROORRSS EEPPEERRMM A non-super user attempts to do a priority increase by supplying a negative _i_n_c. OPEN(2) System calls OPEN(2) NNAAMMEE open, creat - open and possibly create a file or device SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ##iinncclluuddee <> iinntt ooppeenn((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e,, iinntt _f_l_a_g_s));; iinntt ooppeenn((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e,, iinntt _f_l_a_g_s,, mmooddee__tt _m_o_d_e));; iinntt ccrreeaatt((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e,, mmooddee__tt _m_o_d_e));; DDEESSCCRRIIPPTTIIOONN The ooppeenn(()) system call is used to convert a pathname into a file descriptor (a small, non-negative integer for use in subsequent I/O as with rreeaadd, wwrriittee, etc.). When the call is successful, the file descriptor returned will be the lowest file descriptor not currently open for the pro- cess. This call creates a new open file, not shared with any other process. (But shared open files may arise via the ffoorrkk(2) system call.) The new file descriptor is set PAUSE(2) Linux Programmer's Manual PAUSE(2) NNAAMMEE pause - wait for signal SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ppaauussee((vvooiidd));; DDEESSCCRRIIPPTTIIOONN The ppaauussee library function causes the invoking process (or thread) to sleep until a signal is received that either terminates it or causes it to call a signal-catching func- tion. RREETTUURRNN VVAALLUUEE The ppaauussee function only returns when a signal was caught and the signal-catching function returned. In this case ppaauussee returns -1, and _e_r_r_n_o is set to EEIINNTTRR. EERRRROORRSS EEIINNTTRR a signal was caught and the signal-catching func- PIPE(2) Linux Programmer's Manual PIPE(2) NNAAMMEE pipe - create pipe SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ppiippee((iinntt _f_i_l_e_d_e_s[[22]]));; DDEESSCCRRIIPPTTIIOONN ppiippee creates a pair of file descriptors, pointing to a pipe inode, and places them in the array pointed to by _f_i_l_e_d_e_s. _f_i_l_e_d_e_s_[_0_] is for reading, _f_i_l_e_d_e_s_[_1_] is for writing. RREETTUURRNN VVAALLUUEE On success, zero is returned. On error, -1 is returned, and _e_r_r_n_o is set appropriately. EERRRROORRSS EEMMFFIILLEE Too many file descriptors are in use by the pro- cess. POLL(2) Linux Programmer's Manual POLL(2) NNAAMMEE poll - wait for some event on a file descriptor SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ppoollll((ssttrruucctt ppoollllffdd **_u_f_d_s,, uunnssiiggnneedd iinntt _n_f_d_s,, iinntt _t_i_m_e_- _o_u_t));; DDEESSCCRRIIPPTTIIOONN ppoollll is a variation on the theme of sseelleecctt. It specifies an array of _n_f_d_s structures of type struct pollfd { int fd; /* file descriptor */ short events; /* requested events */ short revents; /* returned events */ }; and a _t_i_m_e_o_u_t in milliseconds. A negative value means infinite timeout. The field _f_d contains a file descriptor for an open file. The field _e_v_e_n_t_s is an input parameter, a bitmask specifying the events the application is inter- READ(2) Linux Programmer's Manual READ(2) NNAAMMEE read - read from a file descriptor SSYYNNOOPPSSIISS ##iinncclluuddee <> ssssiizzee__tt rreeaadd((iinntt _f_d,, vvooiidd **_b_u_f,, ssiizzee__tt _c_o_u_n_t));; DDEESSCCRRIIPPTTIIOONN rreeaadd(()) attempts to read up to _c_o_u_n_t bytes from file descriptor _f_d into the buffer starting at _b_u_f. If _c_o_u_n_t is zero, rreeaadd(()) returns zero and has no other results. If _c_o_u_n_t is greater than SSIZE_MAX, the result is unspecified. RREETTUURRNN VVAALLUUEE On success, the number of bytes read is returned (zero indicates end of file), and the file position is advanced by this number. It is not an error if this number is READDIR(2) Linux Programmer's Manual READDIR(2) NNAAMMEE readdir - read directory entry SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ##iinncclluuddee <> __ssyyssccaallll33((iinntt,, rreeaaddddiirr,, uuiinntt,, ffdd,, ssttrruucctt ddiirreenntt **,, ddiirrpp,, uuiinntt,, ccoouunntt));; iinntt rreeaaddddiirr((uunnssiiggnneedd iinntt _f_d,, ssttrruucctt ddiirreenntt **_d_i_r_p,, uunnssiiggnneedd iinntt _c_o_u_n_t));; DDEESSCCRRIIPPTTIIOONN This is not the function you are interested in. Look at rreeaaddddiirr(3) for the POSIX conforming C library interface. This page documents the bare kernel system call interface, which can change, and which is superseded by ggeettddeennttss(2). rreeaaddddiirr reads one _d_i_r_e_n_t structure from the directory pointed at by _f_d into the memory area pointed to by _d_i_r_p. The parameter _c_o_u_n_t is ignored; at most one dirent struc- READLINK(2) Linux Programmer's Manual READLINK(2) NNAAMMEE readlink - read value of a symbolic link SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt rreeaaddlliinnkk((ccoonnsstt cchhaarr **_p_a_t_h,, cchhaarr **_b_u_f,, ssiizzee__tt _b_u_f_s_i_z));; DDEESSCCRRIIPPTTIIOONN rreeaaddlliinnkk places the contents of the symbolic link _p_a_t_h in the buffer _b_u_f, which has size _b_u_f_s_i_z. rreeaaddlliinnkk does not append a NNUULL character to _b_u_f. It will truncate the con- tents (to a length of _b_u_f_s_i_z characters), in case the buffer is too small to hold all of the contents. RREETTUURRNN VVAALLUUEE The call returns the count of characters placed in the buffer if it succeeds, or a -1 if an error occurs, placing the error code in _e_r_r_n_o. EERRRROORRSS REMOVEXATTR(2) System calls REMOVEXATTR(2) NNAAMMEE removexattr, lremovexattr, fremovexattr - remove an extended attribute SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt rreemmoovveexxaattttrr ((ccoonnsstt cchhaarr **_p_a_t_h,, ccoonnsstt cchhaarr **_n_a_m_e));; iinntt llrreemmoovveexxaattttrr ((ccoonnsstt cchhaarr **_p_a_t_h,, ccoonnsstt cchhaarr **_n_a_m_e));; iinntt ffrreemmoovveexxaattttrr ((iinntt _f_i_l_e_d_e_s,, ccoonnsstt cchhaarr **_n_a_m_e));; DDEESSCCRRIIPPTTIIOONN Extended attributes are _n_a_m_e:value pairs associated with inodes (files, directories, symlinks, etc). They are extensions to the normal attributes which are associated with all inodes in the system (i.e. the ssttaatt(2) data). A complete overview of extended attributes concepts can be found in aattttrr(5). rreemmoovveexxaattttrr removes the extended attribute identified by RENAME(2) Linux Programmer's Manual RENAME(2) NNAAMMEE rename - change the name or location of a file SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt rreennaammee((ccoonnsstt cchhaarr **_o_l_d_p_a_t_h,, ccoonnsstt cchhaarr **_n_e_w_p_a_t_h));; DDEESSCCRRIIPPTTIIOONN rreennaammee renames a file, moving it between directories if required. Any other hard links to the file (as created using lliinnkk(2)) are unaffected. If _n_e_w_p_a_t_h already exists it will be atomically replaced (subject to a few conditions - see ERRORS below), so that there is no point at which another process attempting to access _n_e_w_p_a_t_h will find it missing. If _n_e_w_p_a_t_h exists but the operation fails for some reason RMDIR(2) Linux Programmer's Manual RMDIR(2) NNAAMMEE rmdir - delete a directory SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt rrmmddiirr((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e));; DDEESSCCRRIIPPTTIIOONN rrmmddiirr deletes a directory, which must be empty. RREETTUURRNN VVAALLUUEE On success, zero is returned. On error, -1 is returned, and _e_r_r_n_o is set appropriately. EERRRROORRSS EEPPEERRMM The filesystem containing _p_a_t_h_n_a_m_e does not support the removal of directories. EEFFAAUULLTT _p_a_t_h_n_a_m_e points outside your accessible address space. SELECT(2) Linux Programmer's Manual SELECT(2) NNAAMMEE select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - syn- chronous I/O multiplexing SSYYNNOOPPSSIISS /* According to POSIX 1003.1-2001 */ ##iinncclluuddee <> /* According to earlier standards */ ##iinncclluuddee <> ##iinncclluuddee <> ##iinncclluuddee <> iinntt sseelleecctt((iinntt _n,, ffdd__sseett **_r_e_a_d_f_d_s,, ffdd__sseett **_w_r_i_t_e_f_d_s,, ffdd__sseett **_e_x_c_e_p_t_f_d_s,, ssttrruucctt ttiimmeevvaall **_t_i_m_e_o_u_t));; iinntt ppsseelleecctt((iinntt _n,, ffdd__sseett **_r_e_a_d_f_d_s,, ffdd__sseett **_w_r_i_t_e_f_d_s,, ffdd__sseett **_e_x_c_e_p_t_f_d_s,, ccoonnsstt ssttrruucctt ttiimmeessppeecc **_t_i_m_e_o_u_t,, ccoonnsstt ssiiggsseett__tt **_s_i_g_m_a_s_k));; FFDD__CCLLRR((iinntt _f_d,, ffdd__sseett **_s_e_t));; SETGID(2) Linux Programmer's Manual SETGID(2) NNAAMMEE setgid - set group identity SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt sseettggiidd((ggiidd__tt _g_i_d));; DDEESSCCRRIIPPTTIIOONN sseettggiidd sets the effective group ID of the current process. If the caller is the superuser, the real and saved group ID's are also set. Under Linux, sseettggiidd is implemented like the POSIX version with the _POSIX_SAVED_IDS feature. This allows a setgid program that is not suid root to drop all of its group privileges, do some un-privileged work, and then re-engage the original effective group ID in a secure manner. RREETTUURRNN VVAALLUUEE SETUID(2) Linux Programmer's Manual SETUID(2) NNAAMMEE setuid - set user identity SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt sseettuuiidd((uuiidd__tt _u_i_d));; DDEESSCCRRIIPPTTIIOONN sseettuuiidd sets the effective user ID of the current process. If the effective userid of the caller is root, the real and saved user ID's are also set. Under Linux, sseettuuiidd is implemented like the POSIX version with the _POSIX_SAVED_IDS feature. This allows a setuid (other than root) program to drop all of its user privi- leges, do some un-privileged work, and then re-engage the original effective user ID in a secure manner. If the user is root or the program is setuid root, special SETXATTR(2) System calls SETXATTR(2) NNAAMMEE setxattr, lsetxattr, fsetxattr - set an extended attribute value SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> iinntt sseettxxaattttrr ((ccoonnsstt cchhaarr **_p_a_t_h,, ccoonnsstt cchhaarr **_n_a_m_e,, ccoonnsstt vvooiidd **_v_a_l_u_e,, ssiizzee__tt _s_i_z_e,, iinntt _f_l_a_g_s));; iinntt llsseettxxaattttrr ((ccoonnsstt cchhaarr **_p_a_t_h,, ccoonnsstt cchhaarr **_n_a_m_e,, ccoonnsstt vvooiidd **_v_a_l_u_e,, ssiizzee__tt _s_i_z_e,, iinntt _f_l_a_g_s));; iinntt ffsseettxxaattttrr ((iinntt _f_i_l_e_d_e_s,, ccoonnsstt cchhaarr **_n_a_m_e,, ccoonnsstt vvooiidd **_v_a_l_u_e,, ssiizzee__tt _s_i_z_e,, iinntt _f_l_a_g_s));; DDEESSCCRRIIPPTTIIOONN Extended attributes are _n_a_m_e:_v_a_l_u_e pairs associated with inodes (files, directories, symlinks, etc). They are extensions to the normal attributes which are associated with all inodes in the system (i.e. the ssttaatt(2) data). A complete overview of extended attributes concepts can be SIGACTION(2) Linux Programmer's Manual SIGACTION(2) NNAAMMEE sigaction, sigprocmask, sigpending, sigsuspend - POSIX signal handling functions. SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ssiiggaaccttiioonn((iinntt _s_i_g_n_u_m,, ccoonnsstt ssttrruucctt ssiiggaaccttiioonn **_a_c_t,, ssttrruucctt ssiiggaaccttiioonn **_o_l_d_a_c_t));; iinntt ssiiggpprrooccmmaasskk((iinntt _h_o_w,, ccoonnsstt ssiiggsseett__tt **_s_e_t,, ssiiggsseett__tt **_o_l_d_s_e_t));; iinntt ssiiggppeennddiinngg((ssiiggsseett__tt **_s_e_t));; iinntt ssiiggssuussppeenndd((ccoonnsstt ssiiggsseett__tt **_m_a_s_k));; DDEESSCCRRIIPPTTIIOONN The ssiiggaaccttiioonn system call is used to change the action taken by a process on receipt of a specific signal. SIGBLOCK(2) Linux Programmer's Manual SIGBLOCK(2) NNAAMMEE sigblock, siggetmask, sigsetmask, sigmask - manipulate the signal mask SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ssiiggbblloocckk((iinntt _m_a_s_k));; iinntt ssiiggggeettmmaasskk((vvooiidd));; iinntt ssiiggsseettmmaasskk((iinntt _m_a_s_k));; iinntt ssiiggmmaasskk((iinntt _s_i_g_n_u_m));; DDEESSCCRRIIPPTTIIOONN This interface is made obsolete by ssiiggpprrooccmmaasskk(2). The ssiiggbblloocckk system call adds the signals specified in _m_a_s_k to the set of signals currently being blocked from delivery. SIGBLOCK(2) Linux Programmer's Manual SIGBLOCK(2) NNAAMMEE sigblock, siggetmask, sigsetmask, sigmask - manipulate the signal mask SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ssiiggbblloocckk((iinntt _m_a_s_k));; iinntt ssiiggggeettmmaasskk((vvooiidd));; iinntt ssiiggsseettmmaasskk((iinntt _m_a_s_k));; iinntt ssiiggmmaasskk((iinntt _s_i_g_n_u_m));; DDEESSCCRRIIPPTTIIOONN This interface is made obsolete by ssiiggpprrooccmmaasskk(2). The ssiiggbblloocckk system call adds the signals specified in _m_a_s_k to the set of signals currently being blocked from delivery. SIGBLOCK(2) Linux Programmer's Manual SIGBLOCK(2) NNAAMMEE sigblock, siggetmask, sigsetmask, sigmask - manipulate the signal mask SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ssiiggbblloocckk((iinntt _m_a_s_k));; iinntt ssiiggggeettmmaasskk((vvooiidd));; iinntt ssiiggsseettmmaasskk((iinntt _m_a_s_k));; iinntt ssiiggmmaasskk((iinntt _s_i_g_n_u_m));; DDEESSCCRRIIPPTTIIOONN This interface is made obsolete by ssiiggpprrooccmmaasskk(2). The ssiiggbblloocckk system call adds the signals specified in _m_a_s_k to the set of signals currently being blocked from delivery. SIGNAL(2) Linux Programmer's Manual SIGNAL(2) NNAAMMEE signal - ANSI C signal handling SSYYNNOOPPSSIISS ##iinncclluuddee <> ttyyppeeddeeff vvooiidd ((**ssiigghhaannddlleerr__tt))((iinntt));; ssiigghhaannddlleerr__tt ssiiggnnaall((iinntt _s_i_g_n_u_m,, ssiigghhaannddlleerr__tt _h_a_n_d_l_e_r));; DDEESSCCRRIIPPTTIIOONN The ssiiggnnaall() system call installs a new signal handler for the signal with number _s_i_g_n_u_m. The signal handler is set to _s_i_g_h_a_n_d_l_e_r which may be a user specified function, or either SSIIGG__IIGGNN or SSIIGG__DDFFLL. Upon arrival of a signal with number _s_i_g_n_u_m the following happens. If the corresponding handler is set to SSIIGG__IIGGNN, then the signal is ignored. If the handler is set to SSIIGG__DDFFLL, then the default action associated to the signal (see ssiiggnnaall(7)) occurs. Finally, if the handler is set to SIGPAUSE(2) Linux Programmer's Manual SIGPAUSE(2) NNAAMMEE sigpause - atomically release blocked signals and wait for interrupt SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ssiiggppaauussee((iinntt _s_i_g_m_a_s_k));; DDEESSCCRRIIPPTTIIOONN This interface is made obsolete by ssiiggssuussppeenndd(2). ssiiggppaauussee assigns _s_i_g_m_a_s_k to the set of masked signals and then waits for a signal to arrive; on return the set of masked signals is restored. _s_i_g_m_a_s_k is usually 0 to indicate that no signals are to be blocked. ssiiggppaauussee always terminates by being interrupted, returning -1 with _e_r_r_n_o set to EEIINNTTRR. CCOONNFFOORRMMIINNGG TTOO SIGACTION(2) Linux Programmer's Manual SIGACTION(2) NNAAMMEE sigaction, sigprocmask, sigpending, sigsuspend - POSIX signal handling functions. SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ssiiggaaccttiioonn((iinntt _s_i_g_n_u_m,, ccoonnsstt ssttrruucctt ssiiggaaccttiioonn **_a_c_t,, ssttrruucctt ssiiggaaccttiioonn **_o_l_d_a_c_t));; iinntt ssiiggpprrooccmmaasskk((iinntt _h_o_w,, ccoonnsstt ssiiggsseett__tt **_s_e_t,, ssiiggsseett__tt **_o_l_d_s_e_t));; iinntt ssiiggppeennddiinngg((ssiiggsseett__tt **_s_e_t));; iinntt ssiiggssuussppeenndd((ccoonnsstt ssiiggsseett__tt **_m_a_s_k));; DDEESSCCRRIIPPTTIIOONN The ssiiggaaccttiioonn system call is used to change the action taken by a process on receipt of a specific signal. SIGACTION(2) Linux Programmer's Manual SIGACTION(2) NNAAMMEE sigaction, sigprocmask, sigpending, sigsuspend - POSIX signal handling functions. SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ssiiggaaccttiioonn((iinntt _s_i_g_n_u_m,, ccoonnsstt ssttrruucctt ssiiggaaccttiioonn **_a_c_t,, ssttrruucctt ssiiggaaccttiioonn **_o_l_d_a_c_t));; iinntt ssiiggpprrooccmmaasskk((iinntt _h_o_w,, ccoonnsstt ssiiggsseett__tt **_s_e_t,, ssiiggsseett__tt **_o_l_d_s_e_t));; iinntt ssiiggppeennddiinngg((ssiiggsseett__tt **_s_e_t));; iinntt ssiiggssuussppeenndd((ccoonnsstt ssiiggsseett__tt **_m_a_s_k));; DDEESSCCRRIIPPTTIIOONN The ssiiggaaccttiioonn system call is used to change the action taken by a process on receipt of a specific signal. SIGQUEUE(2) Linux Programmer's Manual SIGQUEUE(2) NNAAMMEE sigqueue - queue a signal and data to a process SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ssiiggqquueeuuee((ppiidd__tt _p_i_d,, iinntt _s_i_g,, ccoonnsstt uunniioonn ssiiggvvaall _v_a_l_u_e));; DDEESSCCRRIIPPTTIIOONN ssiiggqquueeuuee() sends the signal specified in _s_i_g to the pro- cess whose PID is given in _p_i_d. The permissions required to send a signal are the same as for kkiillll(2). As with kkiillll(2), the null signal (0) can be used to check if a process with a given PID exists. The _v_a_l_u_e argument is used to specify an accompanying item of data (either an integer or a pointer value) to be sent with the signal, and has the following type: union sigval { SIGRETURN(2) Linux Programmer's Manual SIGRETURN(2) NNAAMMEE sigreturn - return from signal handler and cleanup stack frame SSYYNNOOPPSSIISS iinntt ssiiggrreettuurrnn((uunnssiiggnneedd lloonngg _____u_n_u_s_e_d));; DDEESSCCRRIIPPTTIIOONN When the Linux kernel creates the stack frame for a signal handler, a call to ssiiggrreettuurrnn is inserted into the stack frame so that the the signal handler will call ssiiggrreettuurrnn upon return. This inserted call to ssiiggrreettuurrnn cleans up the stack so that the process can restart from where it was interrupted by the signal. RREETTUURRNN VVAALLUUEE ssiiggrreettuurrnn never returns. WWAARRNNIINNGG The ssiiggrreettuurrnn call is used by the kernel to implement sig- nal handlers. It should nneevveerr be called directly. Better SIGBLOCK(2) Linux Programmer's Manual SIGBLOCK(2) NNAAMMEE sigblock, siggetmask, sigsetmask, sigmask - manipulate the signal mask SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ssiiggbblloocckk((iinntt _m_a_s_k));; iinntt ssiiggggeettmmaasskk((vvooiidd));; iinntt ssiiggsseettmmaasskk((iinntt _m_a_s_k));; iinntt ssiiggmmaasskk((iinntt _s_i_g_n_u_m));; DDEESSCCRRIIPPTTIIOONN This interface is made obsolete by ssiiggpprrooccmmaasskk(2). The ssiiggbblloocckk system call adds the signals specified in _m_a_s_k to the set of signals currently being blocked from delivery. SIGACTION(2) Linux Programmer's Manual SIGACTION(2) NNAAMMEE sigaction, sigprocmask, sigpending, sigsuspend - POSIX signal handling functions. SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ssiiggaaccttiioonn((iinntt _s_i_g_n_u_m,, ccoonnsstt ssttrruucctt ssiiggaaccttiioonn **_a_c_t,, ssttrruucctt ssiiggaaccttiioonn **_o_l_d_a_c_t));; iinntt ssiiggpprrooccmmaasskk((iinntt _h_o_w,, ccoonnsstt ssiiggsseett__tt **_s_e_t,, ssiiggsseett__tt **_o_l_d_s_e_t));; iinntt ssiiggppeennddiinngg((ssiiggsseett__tt **_s_e_t));; iinntt ssiiggssuussppeenndd((ccoonnsstt ssiiggsseett__tt **_m_a_s_k));; DDEESSCCRRIIPPTTIIOONN The ssiiggaaccttiioonn system call is used to change the action taken by a process on receipt of a specific signal. STAT(2) System calls STAT(2) NNAAMMEE stat, fstat, lstat - get file status SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ##iinncclluuddee <> iinntt ssttaatt((ccoonnsstt cchhaarr **_f_i_l_e___n_a_m_e,, ssttrruucctt ssttaatt **_b_u_f));; iinntt ffssttaatt((iinntt _f_i_l_e_d_e_s,, ssttrruucctt ssttaatt **_b_u_f));; iinntt llssttaatt((ccoonnsstt cchhaarr **_f_i_l_e___n_a_m_e,, ssttrruucctt ssttaatt **_b_u_f));; DDEESSCCRRIIPPTTIIOONN These functions return information about the specified file. You do not need any access rights to the file to get this information but you need search rights to all directories named in the path leading to the file. ssttaatt stats the file pointed to by _f_i_l_e___n_a_m_e and fills in _b_u_f. SYNC(2) Linux Programmer's Manual SYNC(2) NNAAMMEE sync - commit buffer cache to disk. SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd ssyynncc((vvooiidd));; DDEESSCCRRIIPPTTIIOONN ssyynncc first commits inodes to buffers, and then buffers to disk. EERRRROORRSS This function is always successful. CCOONNFFOORRMMIINNGG TTOO SVr4, SVID, X/OPEN, BSD 4.3 BBUUGGSS According to the standard specification (e.g., SVID), ssyynncc(()) schedules the writes, but may return before the TIME(2) Linux Programmer's Manual TIME(2) NNAAMMEE time - get time in seconds SSYYNNOOPPSSIISS ##iinncclluuddee <> ttiimmee__tt ttiimmee((ttiimmee__tt **_t));; DDEESSCCRRIIPPTTIIOONN ttiimmee returns the time since the Epoch (00:00:00 UTC, Jan- uary 1, 1970), measured in seconds. If _t is non-NULL, the return value is also stored in the memory pointed to by _t. RREETTUURRNN VVAALLUUEE On success, the value of time in seconds since the Epoch is returned. On error, ((time_t)-1) is returned, and _e_r_r_n_o is set appropriately. EERRRROORRSS UMASK(2) Linux Programmer's Manual UMASK(2) NNAAMMEE umask - set file creation mask SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> mmooddee__tt uummaasskk((mmooddee__tt _m_a_s_k));; DDEESSCCRRIIPPTTIIOONN uummaasskk sets the umask to _m_a_s_k & 0777. The umask is used by ooppeenn(2) to set initial file permis- sions on a newly-created file. Specifically, permissions in the umask are turned off from the mmooddee argument to ooppeenn(2) (so, for example, the common umask default value of 022 results in new files being created with permissions 0666 & ~022 = 0644 = rw-r--r-- in the usual case where the mmooddee is specified as 0666). RREETTUURRNN VVAALLUUEE UNAME(2) Linux Programmer's Manual UNAME(2) NNAAMMEE uname - get name and information about current kernel SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt uunnaammee((ssttrruucctt uuttssnnaammee **_b_u_f));; DDEESSCCRRIIPPTTIIOONN uunnaammee returns system information in the structure pointed to by _b_u_f. The _u_t_s_n_a_m_e struct is defined in _<_s_y_s_/_u_t_s_n_a_m_e_._h_>: struct utsname { char sysname[]; char nodename[]; char release[]; char version[]; char machine[]; #ifdef _GNU_SOURCE char domainname[]; #endif UNLINK(2) Linux Programmer's Manual UNLINK(2) NNAAMMEE unlink - delete a name and possibly the file it refers to SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt uunnlliinnkk((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e));; DDEESSCCRRIIPPTTIIOONN uunnlliinnkk deletes a name from the filesystem. If that name was the last link to a file and no processes have the file open the file is deleted and the space it was using is made available for reuse. If the name was the last link to a file but any processes still have the file open the file will remain in existence until the last file descriptor referring to it is closed. If the name referred to a symbolic link the link is removed. WAIT(2) Linux Programmer's Manual WAIT(2) NNAAMMEE wait, waitpid - wait for process termination SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ppiidd__tt wwaaiitt((iinntt **_s_t_a_t_u_s));; ppiidd__tt wwaaiittppiidd((ppiidd__tt _p_i_d,, iinntt **_s_t_a_t_u_s,, iinntt _o_p_t_i_o_n_s));; DDEESSCCRRIIPPTTIIOONN The wwaaiitt function suspends execution of the current pro- cess until a child has exited, or until a signal is deliv- ered whose action is to terminate the current process or to call a signal handling function. If a child has already exited by the time of the call (a so-called "zom- bie" process), the function returns immediately. Any sys- tem resources used by the child are freed. The wwaaiittppiidd function suspends execution of the current process until a child as specified by the _p_i_d argument has WAIT(2) Linux Programmer's Manual WAIT(2) NNAAMMEE wait, waitpid - wait for process termination SSYYNNOOPPSSIISS ##iinncclluuddee <> ##iinncclluuddee <> ppiidd__tt wwaaiitt((iinntt **_s_t_a_t_u_s));; ppiidd__tt wwaaiittppiidd((ppiidd__tt _p_i_d,, iinntt **_s_t_a_t_u_s,, iinntt _o_p_t_i_o_n_s));; DDEESSCCRRIIPPTTIIOONN The wwaaiitt function suspends execution of the current pro- cess until a child has exited, or until a signal is deliv- ered whose action is to terminate the current process or to call a signal handling function. If a child has already exited by the time of the call (a so-called "zom- bie" process), the function returns immediately. Any sys- tem resources used by the child are freed. The wwaaiittppiidd function suspends execution of the current process until a child as specified by the _p_i_d argument has WRITE(2) Linux Programmer's Manual WRITE(2) NNAAMMEE write - write to a file descriptor SSYYNNOOPPSSIISS ##iinncclluuddee <> ssssiizzee__tt wwrriittee((iinntt _f_d,, ccoonnsstt vvooiidd **_b_u_f,, ssiizzee__tt _c_o_u_n_t));; DDEESSCCRRIIPPTTIIOONN wwrriittee writes up to _c_o_u_n_t bytes to the file referenced by the file descriptor _f_d from the buffer starting at _b_u_f. POSIX requires that a rreeaadd(()) which can be proved to occur after a wwrriittee(()) has returned returns the new data. Note that not all file systems are POSIX conforming. RREETTUURRNN VVAALLUUEE On success, the number of bytes written are returned (zero indicates nothing was written). On error, -1 is returned, and _e_r_r_n_o is set appropriately. If _c_o_u_n_t is zero and the file descriptor refers to a regular file, 0 will be returned without causing any other effect. For a special Homework 1 04/05/2005 - -- Chris Mooney ....................... UNIX Systems Engineer Project DoD ........................ http://home.dod.net/ P.O. Box 7012 ...................... Tel: (207) 450-2332 Portland, ME 04112 ................. chris@dod.net My PGP Public Key Block can be found at: http://chris.dod.net/pgp-public-key.asc Fingerprint: E5C2 E88A CED4 02CB 9D3C 8316 1001 E946 B592 F11C - - -- 1: So the getchar() function can return and error. (i.e. -1) 2: /usr/include is where the typical system files are located. There are also other locations like /usr/local/include or the directory of some package that libraries may be located. 3: Header files may store defines, global variable definitions, structures, function prototypes, some other stuff, and the secret to life. =-) 4: The problem is an overflow that is so large it puts nothing in the high order bytes of the int. This means the bit that indicates negative is completely skipped over. I also tested this with a long and masked out any bits in the upper 4 bytes of the storage, and there was nothing there. This means the overflow is so large that the lower order bits are changed without any indication that the upper bits have been set. To fix the problem, and indeed to find a better solution, we can change the while() condition of val > prevZ_val to: while((val % base) == 0) This would fix the problem for 10; however, it is possible that there may be some other base for which val overflows and still falls on a good multiple of base. One could combine a few techniques (masking and the original check) along with the mod() above to reduce the changes of this problem happening for all bases. 5: The man page for stat states that the function definition is: int stat(const char *file_name, struct stat *buf); The first argument is the filename that the system call should work on. The second argument takes a structure that will be filled with the meta-information of the file. The man pages also state that the return value is: "On success, zero is returned. On error, -1 is returned, and errno is set appropriately." 6: The two attributes are different logically in that one determines if the file is a character stream, file, directory, etc., and the other determines who, owner, group, other, has access along with any special operational attributes of the file (i.e. SUID, SGID, sticky bit). The differences in storage is subtle. Both attributes can be discerned from the stat structure's st_mode member, where the lower order bits indicate the mode and the upper special attributes and the file type. As far as the actual file is concerned, on the disk each file is associates with some meta-information. I hope this answers the question. This is how I read it. 7: The most obvious difference between open() and fopen is that one is a sort of standard C API for accessing files, while the other is the operating system's system call to open some "chunk" of data on the disk. I have found the fopen() can be limiting. For example, when I need to seek to different position and perform heavy file operations I typically prefer the speed and functionality of open(). There are some other differences like the two take different arguments and are written differently, but I assume that is obvious. 8: See program 3. =-) Just kidding. One can use the stat() sys-call to fill a struct stat with the meta-info for the file. You can then use the st_size member of the stat structure to get the information. struct stat info; stat("foo", &info); printf("%d\n", info.st_size); Note: this returns the time in bytes. 9: The shell implements the 'cd' and other commands directly. This means it must perform a chdir() to put the PID in the correct directory. If it did not do the and one changed directory to foo and attempted and ls, how would ls know what directory to open? Yah Yah, environment variables, yuck!! 10: The command 'ln /usr/bin/foo bar' would make a hard link to foo, called bar, in the current directory. Also 'ln -s /usr/bin/foo bar' would make a symbolic link in the same directory. Basically the answer is 'ln' and 'ln -s' respectively. 11: The FILE type can be chased down on both Solaris and Linux; however, the Solaris machines tell very little information about the usage of the structure. The Linux machines, on the other hand, do give information that seems to share similarities to the utmplib.c from the book. In the book we have the variables: fd_utmp num_recs cur_rec Where in the header file (/usr/include/libio.h) on the Linux systems we have: char* _IO_read_ptr; /* Current read pointer */ char* _IO_read_end; /* End of get area. */ char* _IO_read_base; /* Start of putback+get area. */ One would assume that one of the members is used as the file descriptor in the Linux header, but I don't know which one is. This unknown FD would correspond to the fd_utmp variable in utmplib.c. On the other hand we can see that the cur_rec variable corresponds to _IO_read_ptr, and that, while the cur_rec is used as a sort of offset into the utmp file, the _IO_read_base and _IO_read_end could get you the same sort of information. 12: The actual length is dynamic; however, there is a trick in C which allows you to, allocating memory sequentially, put an array at the end of a structure and and still allow you to access its memory. The problem with using a char * is that once the memory is allocated, one must assign the pointer to the appropriate place in memory. This additional step makes the other solution better. 13: The link count for the directory means there are n number of hard links to that directory. The reason every directory has at least two is because the parent to that directory must contain the information for the dir in question, and the dir contains a reference to '.' for itself. The real question is, can someone boot a system, do an rm -fr on /* and change the link count? The /dev or /proc dir would probably stop this, but its a fun idea. 14: I better get credit for this because I accidentally removed file in my home directory. I did a 'mkdir foo', 'cd foo', 'rm -fr ../', and then when it took too long I hit CTRL-C. I have no idea what I removed in my home directory. But I hate this question. It is a good idea that rm does not remove dirs with files in it because it would remove all files and directories in that dir. In effect, rm would do a recessive remove on a directory if it were to perform this operation. As we can see from my mistake... that is bad. Here is the test from the book. What's more, of you do an ls you will get a stale NFS handle. greenlantern <19:25:58>% mkdir foo greenlantern <19:26:25>% cd foo/ greenlantern <19:26:27>% rm -fr ../foo/ greenlantern <19:26:30>% pwd pwd: cannot get current directory: No such file or directory greenlantern <19:26:33>% /bin/pwd /bin/pwd: cannot get current directory: No such file or directory 15: The permutations of AS AW BS BW that cause a race condition are: Time | R1 | R2 | R3 | R4 | ----------------------------------- 1 | BS | AS | BS | AS | 2 | AS | BS | AS | BS | 3 | AW | BW | BW | AW | 4 | BW | AW | AW | BW | ----------------------------------- Where Rn indicates the race condition for that sequence. COS 350: Homework #6 Below are 25 questions about Unix. These are not due until the end of the semester. Some of these are very basic and you should be able to answer them now, others are more complicated. For most of these we will talk about related material at some point in the class, but for some you will have to learn how to solve them on your own. For most of these a single line answer will suffice, such as a Unix command to perform the specified task. I suggest that you start working on these now; they will help increase your knowledge and skills in using the Unix operating system. You may work on these with other students, but you should not give other students the answers. Please feel free to give other students suggestions that will help them to learn and discover the answers on their own. Each students should turn in their own answers to the questions. Each problem is worth 2 points. 1. What is the command for showing the manual pages for Unix commands and system routines? man 2. How can you do a keyword search of the manuals for the word: mail? man -k mail 3. How can you list your files sorted by the time of last modification (earliest first)? ls -t 4. How can you make a directory titled: hw6? mkdir hw6 5. How can you remove that directory? rm -R hw6 6. With one command how can you remove all of the emacs backup files (those ending with a tilde) in a directory? rm *~ 7. Make an Emacs macro to move to the start of the current line, comment out the line with a //, and move to the next line. Now use this macro with a repetition count to comment out a large block of code. press cntrl-x then ( to start the macro then press the home key then press \ twice then press the down arrow then press cntrl-x then ) to stop the macro then press meta-100 cntrl-x e to comment out 100 lines of code 8. Run the C preprocessor on several of your .cpp files. How much do they grow in size? Why? they grow around 5 times their orginial size this is because it is taking all the code from the header files and putting it in the c file. 9. Use find to locate all of your .c files. find . -name '*.c' 10. Make a file in your home directory publicly readable and have another student read it. chmod 744 mysh.cpp 11. Make a link to the course src directory. ln -s /usr/class/cos350/src/ lsrc 12. Edit your .Xdefaults file and change the colors used for Emacs. pico .Xdefaults press cntrl-w and search for !emacs change the colors as you wish 13. Use sdiff to compare two different programs that you have written. What gets matched up? sdiff myls.c myemacs.c it finds whitespace and { matching and thats it 14. What happens if you try to kill your own bash process? If nothing try harder! kill -9 [pidofbash] exits the session 15. What happens if you try to kill someone else's bash process? (Don't kill mine!) just saying kill -9 [theirbashpid] doesnt work but su then kill -9 [theirbashpid] does (did this on my linux box not the schools) 16. Of all the processes running on the system, which has used the most time? How much? top gets the value kscand/Normal 185.33 17. Find the header file that lists all of the system calls by number. How many are there? 258 but some are commented out 18. Explain what the shell commands pushd and popd do? pushd pushes your current directory onto a stack popd retrieves the top most directory from the stack 19. Make a useful command alias. alias -p nano=pico 20. Make a shell script to compile and run one of your programs. !#/bin/bash gcc -g -o myls myls.c myls 21. Permanently change your shell prompt to something else. pico .bashrc add a line PS1="\T>" 22. Using cat, wildcards, a pipe, and wc, give a single Unix command line that will count the total number of lines in all of the .c and .h files contained in all of the homework directories within the course src directory. cat /usr/class/cos350/src/*/*.c /usr/class/cos350/src/*/*.h | wc -l 23. Use grep on /usr/dict/words to determine how many exceptions there are to the rule "I before E except after C". grep -c '[^c]ei' /usr/dict/words 24. For the five Unix programs (or commands) that you use most often, find out where they are located and how big they are. which finds them /bin/ls cd is built into bash /bin/cp /usr/bin/gaim /usr/bin/mozilla 25. Compress /usr/dict/words. What percentage does it shrink by? tar -zcf /home/students/[username]/words.tar /usr/dict/words it is about 40 percent smaller than the orginial LS(1) LS(1) NNAAMMEE ls, dir, vdir - list directory contents SSYYNNOOPPSSIISS llss [[_o_p_t_i_o_n_s]] [[_f_i_l_e_._._.]] ddiirr [[_f_i_l_e_._._.]] vvddiirr [[_f_i_l_e_._._.]] POSIX options: [[--CCFFRRaaccddiillqqrrttuu11]] [[----]] GNU options (shortest form): [[--11aabbccddffgghhiikkllmmnnooppqqrrssttuuvvwwxx-- AABBCCDDFFGGHHLLNNQQRRSSUUXX]] [[--ww _c_o_l_s]] [[--TT _c_o_l_s]] [[--II _p_a_t_t_e_r_n]] [[----ffuullll--ttiimmee]] [[----sshhooww--ccoonnttrrooll--cchhaarrss]] [[----bblloocckk--ssiizzee==_s_i_z_e]] [[----ffoorrmmaatt=={{lloonngg,,vveerrbboossee,,ccoommmmaass,,aaccrroossss,,vveerrttiiccaall,,ssiinnggllee--ccooll-- uummnn}}]] [[----ssoorrtt=={{nnoonnee,,ttiimmee,,ssiizzee,,eexxtteennssiioonn}}]] [[----ttiimmee=={{aattiimmee,,aacccceessss,,uussee,,ccttiimmee,,ssttaattuuss}}]] [[----ccoolloorr[[=={{nnoonnee,,aauuttoo,,aallwwaayyss}}]]]] [[----hheellpp]] [[----vveerrssiioonn]] [[----]] DDEESSCCRRIIPPTTIIOONN The program llss lists first its non-directory _f_i_l_e argu- ments, and then for each directory argument all listable CP(1) CP(1) NNAAMMEE cp - copy files and directories SSYYNNOOPPSSIISS ccpp [[_o_p_t_i_o_n_s]] _f_i_l_e _p_a_t_h ccpp [[_o_p_t_i_o_n_s]] _f_i_l_e_._._. _d_i_r_e_c_t_o_r_y POSIX options: [[--ffiippRRrr]] [[----]] GNU options (shortest form): [[--aabbddffiillpprrssuuvvxxPPRR]] [[--SS _S_U_F_F_I_X]] [[--VV {{nnuummbbeerreedd,,eexxiissttiinngg,,ssiimmppllee}}]] [[----bbaacckkuupp==_C_O_N_T_R_O_L]] [[----ssppaarrssee==_W_H_E_N]] [[----hheellpp]] [[----vveerrssiioonn]] [[----]] DDEESSCCRRIIPPTTIIOONN ccpp copies files (or, optionally, directories). You can either copy one file to a given destination, or copy arbi- trarily many files to a destination directory. If the last argument names an existing directory, ccpp copies each source _f_i_l_e into that directory (retaining the same name). Otherwise, if only two files are given, it cd(n) Tcl Built-In Commands cd(n) _________________________________________________________________ NNAAMMEE cd - Change working directory SSYYNNOOPPSSIISS ccdd ?_d_i_r_N_a_m_e? _________________________________________________________________ DDEESSCCRRIIPPTTIIOONN Change the current working directory to _d_i_r_N_a_m_e, or to the home directory (as specified in the HOME environment vari- able) if _d_i_r_N_a_m_e is not given. Returns an empty string. SSEEEE AALLSSOO filename(n), glob(n), pwd(n) KKEEYYWWOORRDDSS man(1) man(1) NNAAMMEE man - format and display the on-line manual pages manpath - determine user's search path for man pages SSYYNNOOPPSSIISS mmaann [--aaccddffFFhhkkKKttwwWW] [----ppaatthh] [--mm _s_y_s_t_e_m] [--pp _s_t_r_i_n_g] [--CC _c_o_n_f_i_g___f_i_l_e] [--MM _p_a_t_h_l_i_s_t] [--PP _p_a_g_e_r] [--SS _s_e_c_t_i_o_n___l_i_s_t] [_s_e_c_t_i_o_n] _n_a_m_e _._._. DDEESSCCRRIIPPTTIIOONN mmaann formats and displays the on-line manual pages. If you specify _s_e_c_t_i_o_n, mmaann only looks in that section of the manual. _n_a_m_e is normally the name of the manual page, which is typically the name of a command, function, or file. However, if _n_a_m_e contains a slash (//) then mmaann interprets it as a file specification, so that you can do mmaann ..//ffoooo..55 or even mmaann //ccdd//ffoooo//bbaarr..11..ggzz. See below for a description of where mmaann looks for the manual page files. GCC(1) GNU GCC(1) NNNNAAAAMMMMEEEE gcc - GNU project C and C++ compiler SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS gcc [----cccc|----SSSS|----EEEE] [----ssssttttdddd====_s_t_a_n_d_a_r_d] [----gggg] [----ppppgggg] [----OOOO_l_e_v_e_l] [----WWWW_w_a_r_n...] [----ppppeeeeddddaaaannnnttttiiiicccc] [----IIII_d_i_r...] [----LLLL_d_i_r...] [----DDDD_m_a_c_r_o[=_d_e_f_n]...] [----UUUU_m_a_c_r_o] [----ffff_o_p_t_i_o_n...] [----mmmm_m_a_c_h_i_n_e_-_o_p_t_i_o_n...] [----oooo _o_u_t_f_i_l_e] _i_n_f_i_l_e... Only the most useful options are listed here; see below for the remainder. gggg++++++++ accepts mostly the same options as ggggcccccccc. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN When you invoke GCC, it normally does preprocessing, com- pilation, assembly and linking. The ``overall options'' allow you to stop this process at an intermediate stage. For example, the ----cccc option says not to run the linker. CPP(1) GNU CPP(1) NNNNAAAAMMMMEEEE cpp - The C Preprocessor SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS cpp [----DDDD_m_a_c_r_o[=_d_e_f_n]...] [----UUUU_m_a_c_r_o] [----IIII_d_i_r...] [----WWWW_w_a_r_n...] [----MMMM|----MMMMMMMM] [----MMMMGGGG] [----MMMMFFFF _f_i_l_e_n_a_m_e] [----MMMMPPPP] [----MMMMQQQQ _t_a_r_g_e_t...] [----MMMMTTTT _t_a_r_g_e_t...] [----xxxx _l_a_n_g_u_a_g_e] [----ssssttttdddd====_s_t_a_n_d_a_r_d] _i_n_f_i_l_e _o_u_t_f_i_l_e Only the most useful options are listed here; see below for the remainder. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN The C preprocessor, often known as _c_p_p, is a _m_a_c_r_o _p_r_o_c_e_s_- _s_o_r that is used automatically by the C compiler to trans- form your program before compilation. It is called a macro processor because it allows you to define _m_a_c_r_o_s, which are brief abbreviations for longer constructs. gdb(1) GNU Tools gdb(1) NNAAMMEE gdb - The GNU Debugger SSYYNNOOPPSSIISS ggddbb [--hheellpp] [--nnxx] [--qq] [--bbaattcchh] [--ccdd==_d_i_r] [--ff] [--bb _b_p_s] [--ttttyy==_d_e_v] [--ss _s_y_m_f_i_l_e] [--ee _p_r_o_g] [--ssee _p_r_o_g] [--cc _c_o_r_e] [--xx _c_m_d_s] [--dd _d_i_r] [_p_r_o_g[_c_o_r_e|_p_r_o_c_I_D_]_] DDEESSCCRRIIPPTTIIOONN The purpose of a debugger such as GDB is to allow you to see what is going on ``inside'' another program while it executes--or what another program was doing at the moment it crashed. GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act: +o Start your program, specifying anything that might affect its behavior. SORT(1) User Commands SORT(1) NNAAMMEE sort - sort lines of text files SSYYNNOOPPSSIISS ssoorrtt [_O_P_T_I_O_N]... [_F_I_L_E]... DDEESSCCRRIIPPTTIIOONN Write sorted concatenation of all FILE(s) to standard out- put. Ordering options: Mandatory arguments to long options are mandatory for short options too. --bb, ----iiggnnoorree--lleeaaddiinngg--bbllaannkkss ignore leading blanks --dd, ----ddiiccttiioonnaarryy--oorrddeerr consider only blanks and alphanumeric characters --ff, ----iiggnnoorree--ccaassee CAT(1) User Commands CAT(1) NNAAMMEE cat - concatenate files and print on the standard output SSYYNNOOPPSSIISS ccaatt [_O_P_T_I_O_N] [_F_I_L_E]... DDEESSCCRRIIPPTTIIOONN Concatenate FILE(s), or standard input, to standard out- put. --AA, ----sshhooww--aallll equivalent to --vvEETT --bb, ----nnuummbbeerr--nnoonnbbllaannkk number nonblank output lines --ee equivalent to --vvEE --EE, ----sshhooww--eennddss display $ at end of each line HEAD(1) User Commands HEAD(1) NNAAMMEE head - output the first part of files SSYYNNOOPPSSIISS hheeaadd [_O_P_T_I_O_N]... [_F_I_L_E]... DDEESSCCRRIIPPTTIIOONN Print first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. --cc, ----bbyytteess=_S_I_Z_E print first SIZE bytes --nn, ----lliinneess=_N_U_M_B_E_R print first NUMBER lines instead of first 10 DUP(2) Linux Programmer's Manual DUP(2) NNAAMMEE dup, dup2 - duplicate a file descriptor SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt dduupp((iinntt _o_l_d_f_d));; iinntt dduupp22((iinntt _o_l_d_f_d,, iinntt _n_e_w_f_d));; DDEESSCCRRIIPPTTIIOONN dduupp and dduupp22 create a copy of the file descriptor _o_l_d_f_d. After successful return of dduupp or dduupp22, the old and new descriptors may be used interchangeably. They share locks, file position pointers and flags; for example, if the file position is modified by using llsseeeekk on one of the descrip- tors, the position is also changed for the other. The two descriptors do not share the close-on-exec flag, however. MORE(1) System General Commands Manual MORE(1) NNAAMMEE mmoorree - file perusal filter for crt viewing SSYYNNOOPPSSIISS mmoorree [--ddllffppccssuu] [--nnuumm] [+/ pattern] [+ linenum] [_f_i_l_e _._._.] DDEESSCCRRIIPPTTIIOONN MMoorree is a filter for paging through text one screenful at a time. This version is especially primitve. Users should realize that less(1) pro- vides more(1) emulation and extensive enhancements. OOPPTTIIOONNSS Command line options are described below. Options are also taken from the environment variable MORE (make sure to precede them with a dash (``-'')) but command line options will override them. --nnuumm This option specifies an integer which is the screen size (in lines). --dd mmoorree will prompt the user with the message "[Press space to con- tinue, 'q' to quit.]" and will display "[Press 'h' for instruc- tions.]" instead of ringing the bell when an illegal key is pressed. WHO(1) User Commands WHO(1) NNAAMMEE who - show who is logged on SSYYNNOOPPSSIISS wwhhoo [_O_P_T_I_O_N]... [ _F_I_L_E _| _A_R_G_1 _A_R_G_2 ] DDEESSCCRRIIPPTTIIOONN --aa, ----aallll same as --bb --dd ----llooggiinn --pp --rr --tt --TT --uu --bb, ----bboooott time of last system boot --dd, ----ddeeaadd print dead processes --HH, ----hheeaaddiinngg print line of column headings --ii, ----iiddllee add idle time as HOURS:MINUTES, . or old (depre- GREP(1) GREP(1) NNAAMMEE grep, egrep, fgrep - print lines matching a pattern SSYYNNOOPPSSIISS ggrreepp [_o_p_t_i_o_n_s] _P_A_T_T_E_R_N [_F_I_L_E...] ggrreepp [_o_p_t_i_o_n_s] [--ee _P_A_T_T_E_R_N | --ff _F_I_L_E] [_F_I_L_E...] DDEESSCCRRIIPPTTIIOONN GGrreepp searches the named input _F_I_L_Es (or standard input if no files are named, or the file name -- is given) for lines containing a match to the given _P_A_T_T_E_R_N. By default, ggrreepp prints the matching lines. In addition, two variant programs eeggrreepp and ffggrreepp are available. EEggrreepp is the same as ggrreepp --EE. FFggrreepp is the same as ggrreepp --FF. OOPPTTIIOONNSS --AA _N_U_M, ----aafftteerr--ccoonntteexxtt==_N_U_M Print _N_U_M lines of trailing context after matching lines. Places a line containing ---- between con- FIND(1L) FIND(1L) NNAAMMEE find - search for files in a directory hierarchy SSYYNNOOPPSSIISS ffiinndd [path...] [expression] DDEESSCCRRIIPPTTIIOONN This manual page documents the GNU version of ffiinndd. ffiinndd searches the directory tree rooted at each given file name by evaluating the given expression from left to right, according to the rules of precedence (see section OPERA- TORS), until the outcome is known (the left hand side is false for _a_n_d operations, true for _o_r), at which point ffiinndd moves on to the next file name. The first argument that begins with `-', `(', `)', `,', or `!' is taken to be the beginning of the expression; any arguments before it are paths to search, and any arguments after it are the rest of the expression. If no paths are given, the current directory is used. If no expression is given, the expression `-print' is used. CHMOD(1) CHMOD(1) NNAAMMEE chmod - change access permissions of files SSYYNNOOPPSSIISS cchhmmoodd [[_o_p_t_i_o_n_s]] _m_o_d_e _f_i_l_e_._._. POSIX options: [[--RR]] [[----]] GNU mode denotation: [[----rreeffeerreennccee==_r_f_i_l_e]] GNU options (shortest form): [[--ccffvvRR]] [[----hheellpp]] [[----vveerrssiioonn]] [[----]] DDEESSCCRRIIPPTTIIOONN cchhmmoodd changes the permissions of each given _f_i_l_e according to _m_o_d_e, which can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the new permissions. The format of a symbolic mode change argument is `[ugoa...][[+-=][rwxXstugo...]...][,...]'. LN(1) LN(1) NNAAMMEE ln - make links between files SSYYNNOOPPSSIISS llnn [[ooppttiioonnss]] _s_o_u_r_c_e [[_d_e_s_t]] llnn [[ooppttiioonnss]] _s_o_u_r_c_e_._._. _d_i_r_e_c_t_o_r_y POSIX options: [[--ff]] [[----]] GNU options (shortest form): [[--bbddffiinnssvvFF]] [[--SS _b_a_c_k_u_p_-_s_u_f_- _f_i_x]] [[--VV {{nnuummbbeerreedd,,eexxiissttiinngg,,ssiimmppllee}}]] [[----hheellpp]] [[----vveerrssiioonn]] [[----]] DDEESSCCRRIIPPTTIIOONN There are two concepts of `link' in Unix, usually called hard link and soft link. A hard link is just a name for a file. (And a file can have several names. It is deleted from disk only when the last name is removed. The number of names is given by llss(1). There is no such thing as an `original' name: all names have the same status. Usually, but not necessarily, all names of a file are found in the UNLINK(1) User Commands UNLINK(1) NNAAMMEE unlink - call the unlink function to remove the specified file SSYYNNOOPPSSIISS uunnlliinnkk _F_I_L_E uunnlliinnkk _O_P_T_I_O_N DDEESSCCRRIIPPTTIIOONN Call the unlink function to remove the specified FILE. ----hheellpp display this help and exit ----vveerrssiioonn output version information and exit AAUUTTHHOORR Written by Michael Stone. RREEPPOORRTTIINNGG BBUUGGSS Report bugs to . WRITE(1) Linux Programmer's Manual WRITE(1) NNAAMMEE write - send a message to another user SSYYNNOOPPSSIISS wwrriittee _u_s_e_r [[_t_t_y_n_a_m_e]] DDEESSCCRRIIPPTTIIOONN WWrriittee allows you to communicate with other users, by copy- ing lines from your terminal to theirs. When you run the wwrriittee command, the user you are writing to gets a message of the form: Message from yourname@yourhost on yourtty at hh:mm ... Any further lines you enter will be copied to the speci- fied user's terminal. If the other user wants to reply, they must run wwrriittee as well. When you are done, type an end-of-file or interrupt char- XTERM(1) XFree86 XTERM(1) NNAAMMEE xterm - terminal emulator for X SSYYNNOOPPSSIISS xxtteerrmm [-_t_o_o_l_k_i_t_o_p_t_i_o_n ...] [-option ...] DDEESSCCRRIIPPTTIIOONN The _x_t_e_r_m program is a terminal emulator for the X Window System. It provides DEC VT102/VT220 (VTxxx) and Tektronix 4014 compatible terminals for programs that cannot use the window system directly. If the underlying operating sys- tem supports terminal resizing capabilities (for example, the SIGWINCH signal in systems derived from 4.3bsd), _x_t_e_r_m will use the facilities to notify programs running in the window whenever it is resized. The VTxxx and Tektronix 4014 terminals each have their own window so that you can edit text in one and look at graph- ics in the other at the same time. To maintain the cor- rect aspect ratio (height/width), Tektronix graphics will be restricted to the largest box with a 4014's aspect MAKE(1L) LOCAL USER COMMANDS MAKE(1L) NNAAMMEE make - GNU make utility to maintain groups of programs SSYYNNOOPPSSIISS mmaakkee [ --ff _m_a_k_e_f_i_l_e ] [ option ] ... target ... WWAARRNNIINNGG This man page is an extract of the documentation of _G_N_U _m_a_k_e _. It is updated only occasionally, because the GNU project does not use nroff. For complete, current docu- mentation, refer to the Info file mmaakkee..iinnffoo which is made from the Texinfo source file mmaakkee..tteexxiinnffoo. DDEESSCCRRIIPPTTIIOONN The purpose of the _m_a_k_e utility is to determine automati- cally which pieces of a large program need to be recom- piled, and issue the commands to recompile them. The man- ual describes the GNU implementation of _m_a_k_e, which was written by Richard Stallman and Roland McGrath. Our exam- ples show C programs, since they are most common, but you can use _m_a_k_e with any programming language whose compiler TOUCH(1) TOUCH(1) NNAAMMEE touch - change file timestamps SSYYNNOOPPSSIISS ttoouucchh [[--aaccmm]][[--rr _r_e_f___f_i_l_e||--tt _t_i_m_e]] [[----]] _f_i_l_e_._._. Obsolescent version: ttoouucchh [[--aaccmm]][[_u_g_l_y___t_i_m_e]] _f_i_l_e_._._. GNU version: ttoouucchh [[--aaccffmm]] [[--rr _f_i_l_e]] [[--tt _d_e_c_i_m_t_i_m_e]] [[--dd _t_i_m_e]] [[----ttiimmee=={{aattiimmee,,aacccceessss,,uussee,,mmttiimmee,,mmooddiiffyy}}]] [[----ddaattee==_t_i_m_e]] [[----rreeffeerreennccee==_f_i_l_e]] [[----nnoo--ccrreeaattee]] [[----hheellpp]] [[----vveerrssiioonn]] [[----]] _f_i_l_e_._._. DDEESSCCRRIIPPTTIIOONN ttoouucchh changes the access and/or modification timestamps of each specified _f_i_l_e. These timestamps are changed to the current time, unless the -r option is specified, in which case they are changed to the corresponding timestamps of the file _r_e_f___f_i_l_e, or the -t option is specified, in which KILL(1) Linux Programmer's Manual KILL(1) NNAAMMEE kill - terminate a process SSYYNNOOPPSSIISS kkiillll [[ --ss _s_i_g_n_a_l || --pp ]] [[ --aa ]] [[ ---- ]] _p_i_d _._._. kkiillll --ll [[ _s_i_g_n_a_l ]] DDEESSCCRRIIPPTTIIOONN The command kkiillll sends the specified signal to the speci- fied process or process group. If no signal is specified, the TERM signal is sent. The TERM signal will kill pro- cesses which do not catch this signal. For other pro- cesses, it may be necessary to use the KILL (9) signal, since this signal cannot be caught. Most modern shells have a builtin kill function, with a usage rather similar to that of the command described here. The `-a' and `-p' options, and the possibility to specify pids by command name is a local extension. OOPPTTIIOONNSS SLEEP(1) User Commands SLEEP(1) NNAAMMEE sleep - delay for a specified amount of time SSYYNNOOPPSSIISS sslleeeepp _N_U_M_B_E_R[_S_U_F_F_I_X]... sslleeeepp _O_P_T_I_O_N DDEESSCCRRIIPPTTIIOONN Pause for NUMBER seconds. SUFFIX may be `s' for seconds (the default), `m' for minutes, `h' for hours or `d' for days. Unlike most implementations that require NUMBER be an integer, here NUMBER may be an arbitrary floating point number. ----hheellpp display this help and exit ----vveerrssiioonn output version information and exit AAUUTTHHOORR Written by Jim Meyering and Paul Eggert. PS(1) Linux User's Manual PS(1) , NNAAMMEE ps - report process status SSYYNNOOPPSSIISS ps [_o_p_t_i_o_n_s] DDEESSCCRRIIPPTTIIOONN ppss(1) gives a snapshot of the current processes. If you want a repetitive update of this status, use top. CCOOMMMMAANNDD--LLIINNEE OOPPTTIIOONNSS This version of ps accepts several kinds of options. Unix98 options may be grouped and must be preceeded by a dash. BSD options may be grouped and must not be used with a dash. GNU long options are preceeded by two dashes. TIME(1) TIME(1) NNAAMMEE time - time a simple command or give resource usage SSYYNNOOPPSSIISS ttiimmee [[_o_p_t_i_o_n_s]] _c_o_m_m_a_n_d [[_a_r_g_u_m_e_n_t_s_._._.]] DDEESSCCRRIIPPTTIIOONN The ttiimmee command runs the specified program _c_o_m_m_a_n_d with the given arguments. When _c_o_m_m_a_n_d finishes, ttiimmee writes a message to standard output giving timing statistics about this program run. These statistics consist of (i) the elapsed real time between invocation and termination, (ii) the user CPU time (the sum of the _t_m_s___u_t_i_m_e and _t_m_s___c_u_t_i_m_e values in a _s_t_r_u_c_t _t_m_s as returned by ttiimmeess(2)), and (iii) the system CPU time (the sum of the _t_m_s___s_t_i_m_e and _t_m_s___c_s_t_i_m_e values in a _s_t_r_u_c_t _t_m_s as returned by ttiimmeess(2)). OOPPTTIIOONN --pp When in the POSIX locale, use the precise tradi- tional format source(n) Tcl Built-In Commands source(n) _________________________________________________________________ NNAAMMEE source - Evaluate a file or resource as a Tcl script SSYYNNOOPPSSIISS ssoouurrccee _f_i_l_e_N_a_m_e ssoouurrccee --rrssrrcc _r_e_s_o_u_r_c_e_N_a_m_e ?_f_i_l_e_N_a_m_e? ssoouurrccee --rrssrrcciidd _r_e_s_o_u_r_c_e_I_d ?_f_i_l_e_N_a_m_e? _________________________________________________________________ DDEESSCCRRIIPPTTIIOONN This command takes the contents of the specified file or resource and passes it to the Tcl interpreter as a text script. The return value from ssoouurrccee is the return value of the last command executed in the script. If an error occurs in evaluating the contents of the script then the ssoouurrccee command will return that error. If a rreettuurrnn com- set(n) Tcl Built-In Commands set(n) _________________________________________________________________ NNAAMMEE set - Read and write variables SSYYNNOOPPSSIISS sseett _v_a_r_N_a_m_e ?_v_a_l_u_e? _________________________________________________________________ DDEESSCCRRIIPPTTIIOONN Returns the value of variable _v_a_r_N_a_m_e. If _v_a_l_u_e is speci- fied, then set the value of _v_a_r_N_a_m_e to _v_a_l_u_e, creating a new variable if one doesn't already exist, and return its value. If _v_a_r_N_a_m_e contains an open parenthesis and ends with a close parenthesis, then it refers to an array ele- ment: the characters before the first open parenthesis are the name of the array, and the characters between the parentheses are the index within the array. Otherwise _v_a_r_N_a_m_e refers to a scalar variable. Normally, _v_a_r_N_a_m_e is unqualified (does not include the names of any containing ENV(1) User Commands ENV(1) NNAAMMEE env - run a program in a modified environment SSYYNNOOPPSSIISS eennvv [_O_P_T_I_O_N]... [_-] [_N_A_M_E_=_V_A_L_U_E]... [_C_O_M_M_A_N_D [_A_R_G]...] DDEESSCCRRIIPPTTIIOONN Set each NAME to VALUE in the environment and run COMMAND. --ii, ----iiggnnoorree--eennvviirroonnmmeenntt start with an empty environment --uu, ----uunnsseett=_N_A_M_E remove variable from the environment ----hheellpp display this help and exit ----vveerrssiioonn output version information and exit A mere - implies --ii. If no COMMAND, print the resulting SCRIPT(1) System General Commands Manual SCRIPT(1) NNAAMMEE ssccrriipptt - make typescript of terminal session SSYYNNOOPPSSIISS ssccrriipptt [--aa] [--cc _C_O_M_M_A_N_D] [--ff] [--qq] [--tt] [_f_i_l_e] DDEESSCCRRIIPPTTIIOONN SSccrriipptt makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument _f_i_l_e is given, ssccrriipptt saves all dialogue in _f_i_l_e. If no file name is given, the typescript is saved in the file _t_y_p_e_s_c_r_i_p_t. Options: --aa Append the output to _f_i_l_e or _t_y_p_e_s_c_r_i_p_t, retaining the prior con- tents. --cc _C_O_M_M_A_N_D Run the COMMAND rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves WC(1) User Commands WC(1) NNAAMMEE wc - print the number of bytes, words, and lines in files SSYYNNOOPPSSIISS wwcc [_O_P_T_I_O_N]... [_F_I_L_E]... DDEESSCCRRIIPPTTIIOONN Print byte, word, and newline counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard input. --cc, ----bbyytteess print the byte counts --mm, ----cchhaarrss print the character counts --ll, ----lliinneess print the newline counts --LL, ----mmaaxx--lliinnee--lleennggtthh DU(1) DU(1) NNAAMMEE du - estimate file space usage SSYYNNOOPPSSIISS dduu [[_o_p_t_i_o_n_s]] [[_f_i_l_e_._._.]] POSIX options: [[--aasskkxx]] [[----]] GNU options (shortest form): [[--aabbccDDhhHHkkllLLmmssSSxxXX]] [[----bblloocckk--ssiizzee==_s_i_z_e]] [[----eexxcclluuddee==_p_a_t_t_e_r_n]] [[----mmaaxx--ddeepptthh==_n]] [[----hheellpp]] [[----vveerrssiioonn]] [[----]] DDEESSCCRRIIPPTTIIOONN dduu reports the amount of disk space used by the specified files, and by each directory in the hierarchies rooted at the specified files. Here `disk space used' means space used for the entire file hierarchy below the specified file. With no arguments, dduu reports the disk space for the cur- rent directory. COMPRESS(1) COMPRESS(1) NNAAMMEE compress, uncompress, zcat - compress and expand data SSYYNNOOPPSSIISS ccoommpprreessss [ --ff ] [ --vv ] [ --cc ] [ --VV ] [ --bb _b_i_t_s ] [ _n_a_m_e _._._. ] uunnccoommpprreessss [ --ff ] [ --vv ] [ --cc ] [ --VV ] [ _n_a_m_e _._._. ] zzccaatt [ --VV ] [ _n_a_m_e _._._. ] DDEESSCCRRIIPPTTIIOONN _C_o_m_p_r_e_s_s reduces the size of the named files using adap- tive Lempel-Ziv coding. Whenever possible, each file is replaced by one with the extension ..ZZ,, while keeping the same ownership modes, access and modification times. If no files are specified, the standard input is compressed to the standard output. Compressed files can be restored to their original form using _u_n_c_o_m_p_r_e_s_s or _z_c_a_t_. The --ff option will force compression of _n_a_m_e_. This is useful for compressing an entire directory, even if some of the files do not actually shrink. If --ff is not given and _c_o_m_p_r_e_s_s is run in the foreground, the user is TAR(1) TAR(1) NNAAMMEE tar - The GNU version of the tar archiving utility SSYYNNOOPPSSIISS ttaarr [ -- ] AA ----ccaatteennaattee ----ccoonnccaatteennaattee || cc ----ccrreeaattee || dd ----ddiiffff ----ccoommppaarree || rr ----aappppeenndd || tt ----lliisstt || uu ----uuppddaattee || xx --eexxttrraacctt ----ggeett [ ----aattiimmee--pprreesseerrvvee ] [ --bb,, ----bblloocckk--ssiizzee NN ] [ --BB,, ----rreeaadd--ffuullll--bblloocckkss ] [ --CC,, ----ddiirreeccttoorryy DDIIRR ] [ ----cchheecckkppooiinntt ] [ --ff,, ----ffiillee [[HHOOSSTT NNAAMMEE::]]FF ] [ ----ffoorrccee-- llooccaall ] [ --FF,, ----iinnffoo--ssccrriipptt FF ----nneeww--vvoolluummee--ssccrriipptt FF ] [ --GG,, ----iinnccrreemmeennttaall ] [ --gg,, ----lliisstteedd--iinnccrreemmeennttaall FF ] [ --hh,, ----ddeerreeffeerreennccee ] [ --ii,, ----iiggnnoorree--zzeerrooss ] [ --jj,, ----bbzziipp22 ] [ ----iiggnnoorree--ffaaiilleedd--rreeaadd ] [ --kk,, ----kkeeeepp--oolldd--ffiilleess ] [ --KK,, ----ssttaarrttiinngg--ffiillee FF ] [ --ll,, ----oonnee--ffiillee--ssyysstteemm ] [ --LL,, ----ttaappee--lleennggtthh NN ] [ --mm,, ----mmooddiiffiiccaattiioonn--ttiimmee ] [ --MM,, ----mmuullttii--vvoolluummee ] [ --NN,, ----aafftteerr--ddaattee DDAATTEE,, ----nneewweerr DDAATTEE ] [ --oo,, ----oolldd--aarrcchhiivvee,, ----ppoorrttaabbiilliittyy ] [ --OO,, ----ttoo--ssttddoouutt ] [ --pp,, ----ssaammee--ppeerrmmiissssiioonnss,, ----pprreesseerrvvee--ppeerrmmiissssiioonnss ] [ --PP,, ----aabbssoolluuttee--nnaammeess ] [ ----pprreesseerrvvee ] [ --RR,, ----rreeccoorrdd--nnuumm-- bbeerr ] [ ----rreemmoovvee--ffiilleess ] [ --ss,, ----ssaammee--oorrddeerr,, ----pprreesseerrvvee-- oorrddeerr ] [ ----ssaammee--oowwnneerr ] [ ----nnuummeerriicc--oowwnneerr ] [ --SS,,