#LyX 1.2 created this file. For more info see https://www.lyx.org/
\lyxformat 220
\textclass docbook-book
\begin_preamble
\end_preamble
\language english
\inputencoding latin1
\fontscheme default
\graphics default
\paperfontsize default
\spacing single
\papersize Custom
\paperpackage a4
\use_geometry 1
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\paperwidth 210mm
\paperheight 297mm
\leftmargin 1cm
\topmargin 1cm
\rightmargin 1cm
\bottommargin 1cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default
\layout Title
GNU/Linux Command-Line Tools Summary
\layout SGML
\layout SGML
\layout SGML
Gareth Anderson
\layout SGML
\layout SGML
\layout SGML
somecsstudent(at)gmail.com
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
Conversion from LyX to DocBook SGML, Index generation
\layout SGML
Chris Karakas
\layout SGML
\layout SGML
\layout SGML
\layout SGML
Linux
\layout SGML
Unix
\layout SGML
commands
\layout SGML
Linux commands
\layout SGML
Unix commands
\layout SGML
Linux tools
\layout SGML
Unix tools
\layout SGML
tutorial
\layout SGML
command line
\layout SGML
prompt
\layout SGML
command reference
\layout SGML
command tutorial
\layout SGML
command line reference
\layout SGML
command line tutorial
\layout SGML
\noindent
tools tutorial
\layout SGML
\noindent
tools reference
\layout SGML
\noindent
tool
\layout SGML
linux command reference
\layout SGML
linux command tutorial
\layout SGML
linux command line reference
\layout SGML
linux command line tutorial
\layout SGML
\noindent
linux tools tutorial
\layout SGML
\noindent
linux tools reference
\layout SGML
\noindent
linux tool
\layout SGML
Unix command reference
\layout SGML
Unix command tutorial
\layout SGML
Unix command line reference
\layout SGML
Unix command line tutorial
\layout SGML
\noindent
Unix tools tutorial
\layout SGML
\noindent
Unix tools reference
\layout SGML
\noindent
Unix tool
\layout SGML
\layout SGML
\begin_inset Note
collapsed false
\layout Section
Stuff to be added before 1.0
\layout Standard
watch execute commands repeatably.
- more of a programmers tool, not added for 1.0!!!!
\layout Section
Standards within the document
\layout Enumerate
All single key presses are surrounded with square brackets, eg.
[TAB]
\layout Enumerate
Using multiple keys is used with a dash eg.
CTRL-ALT-DEL
\layout Enumerate
The first word after the description is always capitalized.
\layout Enumerate
First word of a footnote is always capitalized.
\layout Enumerate
All commands/tools are in italic (emphaized) excluding the bolded part (ie.
first part of description)
\layout Enumerate
Anything that is the name of something, maybe an example use single quotes
'directory'
\layout Enumerate
Command syntax should be replaced by useful examples when possible.
\layout Enumerate
Most symbols are written literally as well as having the symbol there eg.
$ (dollars sign)
\layout Enumerate
Avoid uppercase excluding GNU and UNIX (legally it must be UNIX system)
\layout Enumerate
When using a command prompt: eg.
\series bold
[root@hp166 tmp]#
\series default
make the command prompt part bold and don't make the command part not bold
(I don't think I have any of these left anyway).
\layout Enumerate
Footnotes cannot be on sections/subsections/etc.
because they appear in the index like that (ie.
including the footnote).
\layout Enumerate
When listing options to a command use option --- description (standard within
this guide)
\layout Enumerate
The first word after a description should be capitalized (unless its a command
name).
\layout Enumerate
Only use descriptions when describing something.
Because script picks up everything that is a description environment.
\layout Enumerate
Always have the command syntax, example or simply type on a new line.
\layout Enumerate
The first sentence after a description type should only contain information
on the command.
\layout Enumerate
Use admonitions wherever possible.
\layout Enumerate
Sections are in uppercase (labels) and any other labels in lower case.
\layout Enumerate
Use more than just
\begin_inset Quotes eld
\end_inset
note
\begin_inset Quotes erd
\end_inset
or
\begin_inset Quotes eld
\end_inset
tip
\begin_inset Quotes erd
\end_inset
for notes/tips/warnings.
Put something useful there!
\layout Section
Problems:
\layout Standard
od makes no sense
\layout Standard
neither does tsort.
or dc/bc
\layout Standard
this is becoming huge ~>18K Hopefully its high quality content and not bloat.
\layout Standard
Should 1 and any other small number < 10 be replaced with words? ie.
\begin_inset Quotes eld
\end_inset
one
\begin_inset Quotes erd
\end_inset
.
Because it can be considered unprofessional\SpecialChar \ldots{}
only replaced some numbers with
words --done mostly
\layout Standard
quotes ' ' and ( ) brackets are used to show particular symbols, should
probably be one or the other and not both, oh and theres still some mix
between double and single quotes double quotes are now used most of the
time.
\layout Standard
Decided later to decrease the amount of content significantly.
\layout Section
LyX to DocBook conversion issues
\layout Standard
Don't put index entries before the end of a word, because they'll add spaces
inbetween\SpecialChar \ldots{}
\layout Standard
Mr Anderson: will cause problems...
\layout Standard
Anything that has embedded code-style and then standard text underneath
also embedded will be considered a footnote....but if it has standard text
on-top embedded and code underneath and more text underneath the code (all
on same level) it will not be a footnote....(I think...)\SpecialChar \ldots{}
either that or a weird
problem with lyx occured.
\layout Standard
If you use SGML than anything within that must also be SGML, so don't use
.
because every subsection under that quoted would need to be in pure sgml\SpecialChar \ldots{}
\layout Standard
Use notes and not comment-style because when converted comment style sometimes
is left in the document and sometimes its not, notes are never exported
from the document (ie never use comments within this doc!).
\layout Standard
Be careful when changing labels, the labels of sections are what the html
files are named, if they are changed then the name of the html file changes
causing a 3month wait for the document to be reindexed with major search
engines (well about 3 months for google anyway!)\SpecialChar \ldots{}
\layout Standard
You were missing quite a few and 's.
You must understand that in SGML, just pressing will NOT create
a new paragraph (as in HTML too, which is an SGML language).
pairs are your friend.
I inserted them whenever I saw them missing, but I am sure there are more
cases that I missed.
\layout Standard
Index-command then label is WRONG (at least for now).
Label and then Index-command is O.K.
I removed some Idx from the titles for this reason.
Either put Idx after the label (not before), or (better) avoid it in the
titles alltogether.
\layout Standard
NEVER use spaces or other bad characters (eg.
'(' and ')' in labels.
just use - to seperate things.
\layout Section
Lists of things to be added:
\layout Standard
add patch before next release.
\layout Standard
add the h* utilities....for working with macintosh disks
\layout Subsection
add how to create filesystems? add mkfs -c to check for bad blocks
\layout Standard
A command, called superformat, from the fdutils package [You may have to
find this pac kage on the Internet.
See Chapter 24 for how to compile and install source packages.] formats
a floppy in any way that you like.
A more common (but less thorough) command is fdformat from the util-linux
package.
It verifies that each track is working properl y and compensates for variations
between the mechanics of different floppy drives.
To format a 3.5-inch 1440-KB, 1680-KB, or 1920-KB floppy, respectively,
run:
\layout Standard
5 cd /dev ./MAKEDEV -v fd0 superformat /dev/fd0H1440 superformat /dev/fd0H1690
superformat /dev/fd0H1920
\layout Standard
and fdformat
\layout Standard
--where is this from probably rute users guide and tutorial thingy.
\layout Subsection
diffing and patching --theres probably better tutorials already online
\layout Standard
The diff utility dumps the lines that differ between two files.
It can be used as follows: diff -u
\layout Standard
You can also use diff to see difference netween two directory trees.
diff recursively compares all corresponding files: diff -u --recursive
--new-file > .diff
\layout Standard
The output is known as a patch file against a directory tree, that can be
used both to see changes, and to bring up to date with .
\layout Standard
Patch files may also end in .patch and are often gzipped.
The patch file can be applied to with
\layout Standard
cd patch -p1 -s < .diff
\layout Standard
which makes identical to .
The -p1 option strips the leading direct ory name from the patch file.
The presence of a leading directory name in the patch fi le often confuses
the patch command.
\layout Section
Other issues
\layout Standard
snice/skill are very similar to renice and kill (with the correct option),
they perform the same task except one was based on bsd and the other relates
to /proc/.
Don't they perform exactly the same thing (nearly)\SpecialChar \ldots{}
?.
Most procps utilities are the same (which is good\SpecialChar \ldots{}
but they are very similar
to existing utilities).
\layout Standard
lpr and lp are historically from BSD based and SysV based Unix systems,
they appear to do the same thing in different ways if you are using CUPS
they do exactly the same thing.
\layout Standard
Changed all references exlcuding UNIX tools philosophy to UNIX system from
Unix (its doesn't look as good but it should be legal now).
Also changed UNIX-like to UNIX system-based (to make it legal)
\layout Section
List of removed tools (or not added):
\layout Standard
There are various stuff now under each subsection now
\layout Subsection
Possibly useful
\layout Standard
gpasswd This command allows the administration of the /etc/group file.
\layout Standard
You can use this command to add administrators to a particular group, these
admins can then add or remove users.
\layout Standard
gpasswd group_name -A list_of_users
\layout Standard
Using "env" page 13 of 13
\layout Standard
Unfortunately, if you forget to set PAGER back to less, man (as well as
some other commands) will continue to display all their text without stopping.
If you wanted to have PAGER set to cat just once, you could use the env
command:
\layout Standard
$ PAGER=less $ env PAGER=cat man man $ echo $PAGER less
\layout Standard
This time, PAGER was exported to man with a value of cat, but the PAGER
variable itself remained unchanged in the bash session.
ikely to be useful
\layout Standard
retry bc and dc --maybe not I won't get the time.
\layout Description
zgv
\begin_inset Note
collapsed false
\layout Standard
probably overkill for the command-line interface.
But i'll leave it anyway (for now) --removed
\end_inset
\emph on
zgv
\emph default
is a graphical vga/svga based program used to view images from the console.
\emph on
zgv
\emph default
is very easy to use, simply run the program and then use [Enter] and[ESC
to view and then stop viewing pictures.
The file selector is a GUI so there are no commands involved there.
\layout Standard
To run
\emph on
zgv
\emph default
simply type:
\layout Code
zgv
\begin_deeper
\layout Standard
Note that you can obtain
\emph on
zgv
\emph default
from
\begin_inset LatexCommand \url[the zgv homepage]{https://www.svgalib.org/rus/zgv/ }
\end_inset
, note that you will also need the svgalib libraries to run
\emph on
zgv
\emph default
.
\end_deeper
\layout Subsection
Unlikely to be useful
\layout Standard
and possibly add sed and awk as major programming languages --decided against,
too complicated plus the fact that it broadens the scope of the document
way too much
\layout Standard
add pushd / popd? -- overkill.
Useful for some but not many (?)
\layout Standard
possibly a cd recording section.
--maybe not\SpecialChar \ldots{}
that just gets too complex and a lot of them exist already.
\layout Standard
ctrlaltdel -- do many people want a hard reset? not added\SpecialChar \ldots{}
\layout Standard
strings -- more of a programmers tool.
I don't see it as useful\SpecialChar \ldots{}
\layout Standard
lsof has not being added, very advanced usage and not very useful to average
user.
\layout Standard
--ddate --just plain weird -- not useful, not added
\layout Standard
fgconsole -- sort of useless....
\layout Standard
export --bash internal stuff and various other bash internal stuff.
\layout Standard
install -- no reason really, this is a users guide more than a programmers
guide.
\layout Standard
diction not accurate enough\SpecialChar \ldots{}
\layout Description
diction
\begin_deeper
\layout Standard
Notes: this tool is now quite vulnerable and is considered to be of little
use.
Diction looks for commonly misused phrases in sentences.
it's a sort of grammar checker, although it usually compares something
to a dictionary of misused phrases and other
\begin_inset Quotes eld
\end_inset
bad
\begin_inset Quotes erd
\end_inset
diction.
it's quite a basic grammar checker though and is now considered
\begin_inset Quotes eld
\end_inset
vulnerable
\begin_inset Quotes erd
\end_inset
compared to more modern grammar checkers (such as those in Microsoft word).
Command syntax:
\layout Code
diction file.txt
\end_deeper
\layout Standard
nslookup (now redundant)
\layout Standard
all old r* commands
\layout Standard
anagram a command that looks for 'anagrams'.
An anagram is a word or phrase whose characters consist entirely of all
the characters of a given word or phrase -- for example, `stop' and `tops'
are both anagrams of `pots'.
-- was direct from cookbook anyway
\layout Standard
sview streaming text viewer, can be used to stream text, ie.
read 1 word at a time at a very fast pace (so it's easier and quicker to
read).
Note this is a graphical program, requires X.
--great program from cookbook but requires X!
\layout Standard
ldd list library dependencies (list shared library dependencies).
A more advanced command.
-- not really useful to average user.
more of a programmers thing.
\layout Standard
spell
\shape italic
\shape default
(spell checker), use spell then the word, or spell than document.
--this was simply calling ispell -i anyway, not very useful
\layout Standard
aview -- ascii image viewer not very useful why not use X?
\layout Standard
sed -e 's/
\backslash
.pcx$/.png/'`" and possibly add sed and awk as major programming languages
--decided against, too complicated plus the fact that it broadens the scope
of the document way too much
\layout Standard
pr
\emph on
pr
\emph default
formats text files for printing.
It adds a header and page number to the text file and can print documents
in columns.
\layout Standard
Use the
\emph on
-t
\emph default
option to avoid the printing of the header and footer on each page.
\layout Standard
\emph on
pr
\emph default
takes a variety of options, read the man and info page for further information.
\begin_inset Note
collapsed false
\layout Standard
not so sure about these commands (both above and below).
I have little experience in Linux Printing.
\end_inset
\layout Subsection
KDE-shortcut\SpecialChar ~
Keys -- this was copyright lockergnome anyway
\layout Standard
\series default
respectively match the empty string at the beginning and end of a word.
\layout Standard
\series bold
\backslash
?
\series default
The preceding item is optional and matched at most once.
\layout Standard
\series bold
\backslash
*
\series default
The preceding item will be matched zero or more times.
\layout Standard
\series bold
\backslash
+
\series default
The preceding item will be matched one or more times.
\layout Standard
\series bold
\backslash
{n}
\series default
The preceding item is matched exactly n times.
\layout Standard
\series bold
\backslash
{n,}
\series default
The preceding item is matched n or more times.
\layout Standard
\series bold
\backslash
{n,m}
\series default
The preceding item is matched at least n times, but not more than m times.
\layout Standard
Note I now find the above useful, but thats in regular expression matching
when making parsers and stuff like that\SpecialChar \ldots{}
\layout Description
ins (insert) will read lines of text from the standard input and insert
them at the beginning of the file.
\begin_inset Note
collapsed false
\layout Standard
need more info on this too.
Only useful in scripts...? --was removed because of an overcrowded tools section.
Not really that useful...
\end_inset
\layout Standard
You can also use
\emph on
ins
\emph default
like this:
\layout Code
ins < from_file some_file.txt
\begin_deeper
\layout Standard
This would have the text from
\begin_inset Quotes eld
\end_inset
from_file
\begin_inset Quotes erd
\end_inset
added to
\begin_inset Quotes eld
\end_inset
some_file.txt
\begin_inset Quotes erd
\end_inset
.
\layout Standard
\emph on
ins
\emph default
is a utility created by the author of the
\begin_inset Quotes eld
\end_inset
Linux Cookbook
\begin_inset Quotes erd
\end_inset
please go
\begin_inset LatexCommand \url[here]{https://addressFIXEMEfixme}
\end_inset
to get
\emph on
ins.
\end_deeper
\layout Standard
adding sed and awk as major programming languages (or any other kind of
programming language) has been decided against\SpecialChar \ldots{}
\layout Description
dircmp Compares directories and outputs a list of different files.
\begin_inset Note
collapsed false
\layout Standard
this tool was superceeded when diff learnt how to compare directories AFAIK
\end_inset
\layout Description
banner Sends a large, vertical "banner" of the message to the standard output.
\begin_deeper
\layout Standard
\noindent
Simply type:
\layout Code
banner
\begin_inset Quotes eld
\end_inset
message to be written
\begin_inset Quotes erd
\end_inset
\begin_inset Note
collapsed false
\layout Standard
pretty useless so it was removed
\end_inset
\end_deeper
\layout Description
znew Recompress a .Z (traditional Unix zip) file into a .gz (gzip) file.
Command syntax:
\begin_deeper
\layout Code
znew filename.Z
\begin_inset Note
collapsed false
\layout Standard
note used often enough
\end_inset
\end_deeper
\layout Subsection
Stopping and Starting Daemons
\begin_inset Note
collapsed false
\layout Standard
section replaced elsewhere
\end_inset
\layout Standard
A daemon is system program that runs in the background (with zero interaction
and is usually independent of user/terminal), these processes usually perform
critical functions such as control swap space, manage incoming connections
and do various other tasks.
Each of these daemons has a script under /etc/rc.d/init.d/ directory written
to accept an argument, which can be (usually)
\series bold
start
\series default
,
\series bold
stop
\series default
and
\series bold
restart.
\series default
You can execute those scripts by hand in fact with a command, you simply
run the program name (./program) and then put start stop or restart there,
e.g.:
\layout Code
\series bold
[root@hp166 init.d]#
\series default
./keytable restart
\layout Description
nstat This command displays the values of a few dozen statistics relating
to network activity that are maintained inside the kernel.
Note: this program uses the /proc/snmp files.
If you don't have an SNMP daemon installed then this tool won't be installed
either.
\layout Description
The\SpecialChar ~
GNU\SpecialChar ~
Miscfiles
\begin_inset Foot
collapsed true
\layout Standard
This information information comes from the Linux Cookbook (without editing).
See [3] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
\begin_inset Note
collapsed false
\layout Standard
is this of any use to anyone?
\layout Standard
possibly remove it\SpecialChar \ldots{}
\end_inset
Are a collection of text files containing various facts and reference material,
such as common abbreviations, telephone area codes, and English connective
phrases.
The files are stored in the `/usr/share/misc' directory, and they are all
compressed; use
\emph on
zless
\emph default
to pursue them or any other
\emph on
z
\emph default
tool (
\emph on
zcat, zmore)
\emph default
.
\layout Standard
\begin_inset LatexCommand \url[GNU Miscfiles Homepage]{https://www.gnu.org/directory/misc/miscfiles.html}
\end_inset
and the
\begin_inset LatexCommand \url[GNU Miscfiles Download Site]{https://ftp.gnu.org/gnu/miscfiles/}
\end_inset
\layout Standard
Audio Tools
\begin_inset LatexCommand \label{Audio-Tools}
\end_inset
\layout Standard
very, very incomplete.
Will this improve the guide or add bloat? Hopefully people will contribute
and make this section useful\SpecialChar \ldots{}
(or ill strip it).
Completely stripped, lack of info and did not really add much to the guide
(besides bloating it).
Some useful info about sox though\SpecialChar \ldots{}
\layout Description
mpg123
\begin_inset Note
collapsed false
\layout Standard
there is also an mpg321 probably some competitor\SpecialChar \ldots{}
, maybe don't add either?...
\end_inset
Used to play MPEG layers 1, 2 and 3 audio.
Ie.
an mp3 player.
\layout Standard
Useful options:
\emph on
--test
\emph default
(test mode) audio is decoded but not actually outputted to audio device,
\emph on
--resync
\emph default
will attempt to continue playing an audio file even if it's damaged (there
may be loud clicks or pops so dont turn the volume up).
Refer to the manual page for detailed information.
\layout Standard
Basic syntax:
\layout Code
mpg123 audio_file.mp3
\layout Code
\layout SGML
Please note
\layout SGML
\layout SGML
Please note that information on mp3 players, encoders or decoders are not
included in this section because there are many articles on these subjects
on the internet already.
\layout SGML
\layout SGML
\layout Description
play
\emph on
play
\emph default
is a frontend to
\emph on
sox
\emph default
which should be able to play any sound file.
(For the effects that you can apply please see the manual page).
Useful options:
\emph on
--device=/dev/xxx
\emph default
specifices which device to play to,
\emph on
--volume=xx
\emph default
change the volume of the file being played.
\begin_deeper
\layout Standard
General syntax:
\layout Code
play fileName
\end_deeper
\layout Description
rec
\emph on
record
\emph default
follows the same syntax as above (it's documented in the same manual page
too!).
\begin_deeper
\layout Standard
For normal use simply type:
\layout Code
rec fileName
\end_deeper
\layout Description
sox (
\begin_inset Quotes eld
\end_inset
sound eXchange: universal sound sample translator
\begin_inset Quotes erd
\end_inset
)
\emph on
sox
\emph default
is part of a group of very powerful command-line based audio tools which
can be used to translate sound files into different types as well as performing
various mixing effects on them.
It can be considered the audio equivalent of
\emph on
convert
\emph default
.
\begin_deeper
\layout Standard
For the most simple usage you may like to try:
\layout Code
sox soundfile.wav outputfile.ogg
\layout Standard
where the first extension (.wav) is the type of the input file and the second
extension (.ogg) in the type of the output file.
\layout Standard
\emph on
sox
\emph default
has hundreds of command-line options, you'll need to refer to the manual
for details.
\end_deeper
\layout Description
aumix Used to control the audio mixer settings.
Use the -v x (where x is a number between 1 and 100) option to change the
main volume.
Use the
\emph on
-q
\emph default
option to list the current settings for everything.
\begin_deeper
\layout Standard
Example:
\layout Code
aumix -v 100 -q
\layout Standard
This will change the volume to 100% then print the current settings.
\end_deeper
\layout Standard
Not really command related and everyone can read this elsewhere :P
\layout Subsection
Drive Letter Labelling (/dev/hd*)
\begin_inset LatexCommand \label{drive-letter-labeling}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
[4] -- too small to be refernced and it's used everywhere anyway --rewritten
a little
\layout Standard
Could be considered common knowledge and removed\SpecialChar \ldots{}
\end_inset
\begin_inset LatexCommand \label{drive-letter-organisation}
\end_inset
\layout Standard
For IDE drives (normally used in end-user systems) GNU/Linux uses the following
naming convention.
Starting with /dev/hda as the first one.
\layout Itemize
a --- first IDE controller set in master mode
\layout Itemize
b --- first IDE controller set in slave mode
\layout Itemize
c --- second IDE controller set in master mode
\layout Itemize
d --- second IDE controller set in slave mode
\layout Standard
\noindent
If you have a third and/or fourth controller, simply continue assigning
letters in alphabetical order, going from controller to controller, and
master to slave.
\layout Subsection
Kernel\SpecialChar ~
Modules
\begin_inset LatexCommand \label{kernel-modules}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
this section needs revision or removal.
-- revised and hopefully more useful now\SpecialChar \ldots{}
\layout Standard
I know nearly nothing about dealing with kernel modules...does anyone has suggestio
ns?
\layout Standard
this section is a candidate for removal\SpecialChar \ldots{}
\end_inset
\layout Standard
These tools are used to work with kernel modules.
Normally hardware is auto-detected and the relevant module(s) (equivalent
to a device driver in windows) are loaded into the kernel so the hardware
can communicate with the operating system.
These tools are helpful if you ever need to manually load modules into
the kernel, remove them or find more information about them.
\layout Description
\noindent
lsmod List currently loaded kernel modules (uses /proc/modules).
You could always just do
\emph on
cat /proc/modules.
\emph default
(or use
\emph on
less
\emph default
or
\emph on
more
\emph default
or other tools\SpecialChar \ldots{}
)
\layout Description
lspci (or lscpidrake on Mandrake systems) is used to list various hardware
devices (connected via pci) and the modules they use (if known).
\begin_deeper
\layout Standard
Use the
\emph on
-v
\emph default
option for more detailed information.
Note this uses the /proc/pci information.
\end_deeper
\layout Description
\noindent
modprobe
\emph on
modprobe
\emph default
is used to insert a module into a running kernel.
\begin_deeper
\layout Standard
\noindent
\emph on
modprobe
\emph default
is usually used instead of
\emph on
insmod
\emph default
,
\emph on
modprobe
\emph default
looks up it's configuration files to work out which particular module you
wanted (ie.
you don't need to type the full path) and automatically resolves any dependenci
es of the particular module.
\emph on
modprobe
\emph default
will call
\emph on
insmod
\emph default
with the full path name and options.
\layout Standard
For example:
\layout Code
modprobe sb
\layout Standard
This will load the sound-blaster (sb) module into the current running kernel.
\layout SGML
\layout SGML
modprobe
\layout SGML
\layout SGML
The
\emph on
modprobe
\emph default
command works with the configuration file /etc/modules.conf you can modify
this configuration file to get
\emph on
modprobe
\emph default
to run certain scripts before or after inserting a module into the kernel.
\layout SGML
\layout SGML
\end_deeper
\layout Description
\noindent
\begin_inset Note
collapsed false
\layout Standard
don't think its useful anymore, I mean its easier just to use modprobe...
\layout Standard
insmod (as root) insert modules into the kernel (a module is roughly an
equivalent of a DOS device driver).
\emph on
modprobe
\emph default
is usually used instead of
\emph on
insmod
\emph default
because
\emph on
insmod
\emph default
needs a full path to the module and cannot resolve dependencies.
\layout Standard
\noindent
Command syntax:
\layout Code
\noindent
insmod module_name
\layout Code
\end_inset
\layout Description
\noindent
rmmod
\emph on
rmmod
\emph default
is used to remove a module from a running kernel, you may like to use
\emph on
lsmod
\emph default
to find out which module to remove.
\begin_deeper
\layout Standard
\noindent
Command syntax:
\layout Code
rmmod module_name
\end_deeper
\layout Description
\noindent
modinfo
\emph on
modinfo
\emph default
is used to learn more information about a particular module.
\begin_deeper
\layout Standard
\noindent
Example:
\layout Code
modinfo ext3
\layout Standard
This will display information about the module named
\begin_inset Quotes eld
\end_inset
ext3
\begin_inset Quotes erd
\end_inset
if it is installed.
\end_deeper
\layout Description
depmod
\emph on
depmod
\emph default
is used to update the module dependency information used by modprobe.
If you add or remove new modules you may need to run
\emph on
depmod
\emph default
again to update the dependency information.
The normal usage of depmod is:
\begin_deeper
\layout Code
depmod -a
\layout Standard
The 'a' is optional and you no longer need to put it there.
\layout Standard
\begin_inset Note
collapsed true
\layout Standard
find out info about using kernel 2.6 and depmod --seems to be ok you just
don't use make dep.
\end_inset
\end_deeper
\layout Standard
Decided to be not useful enough
\layout Subsection
Recovering from a system freeze
\begin_inset LatexCommand \label{system-freeze}
\end_inset
\layout Standard
This information (in this section) has been taken from the Mandrakesoft
Starter Guide, with no editing, anything that is quoted has been used from
the Mandrakesoft Starter Guide, see [8] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\layout Standard
If your system is completely frozen, ie.
you can't kill processes or something quite severe has happened you may
find the following procedure useful to follow:
\layout Standard
\begin_inset Quotes eld
\end_inset
\SpecialChar \ldots{}
the "SysRq" ("System Request") sequence.
The "SysRq" sequence involves pressing three keys at once, the left ALT
key, the SysRq key (labeled PrintScreen on older keyboards) and a letter
key.
\layout Itemize
ALT-SysRq-R this puts the keyboard in "raw" mode.
Now try pressing ALT-CTRL-Backspace again to kill X.
If that does not work, carry on.
\layout Itemize
ALT-SysRq-S this attempts to write all unsaved data to disk ("sync" the
disk).
\layout Itemize
ALT-SysRq-E this sends a termination signal to all processes, except for
init.
\layout Itemize
ALT-SysRq-I this sends a kill signal to all processes, except for init.
\layout Itemize
ALT-SysRq-U this attempts to re-mount all mounted filesystems read-only.
This removes the "dirty flag" and will avoid a file system check upon reboot.
\layout Itemize
ALT-SysRq-B this reboots the system.
You might just as well press the "reset" button on your machine.
\begin_inset Quotes erd
\end_inset
\layout SGML
\layout SGML
This is a sequence
\layout SGML
\layout SGML
"Remember that this is a sequence, i.e.
you have to press one combination after the other in the right order:
\layout SGML
\layout SGML
\layout SGML
Raw, Sync, tErm, kIll, Umount, reBoot.
Read the kernel documentation for more information on this feature."
\layout SGML
\layout SGML
\layout SGML
\layout SGML
An easy way to remember this:
\layout SGML
\layout SGML
"There is a mnemonic phrase that makes this easier to remember: "Raising
Skinny Elephants Is Utterly Boring""
\layout SGML
\layout SGML
\layout Standard
This is usually done by the distro
\layout Description
symlinks\SpecialChar ~
-r\SpecialChar ~
-cds\SpecialChar ~
/ (as root) Check and fix the symbolic links on the system.
The various options stand for recursive (recurse through the file system),
convert absolute links to relative links (always a good idea), remove
\begin_inset Quotes eld
\end_inset
dangling
\begin_inset Quotes erd
\end_inset
links (links that point to a non-existent file) and detect lengthy links,
the last symbol (the slash) stands for start at the top of the filesystem.
\layout Chapter
Printing
\begin_inset LatexCommand \label{Printing}
\end_inset
\layout Standard
The printing chapter only lists the most basic of printing commands.
On most modern GNU/Linux system you will find the CUPS printing system,
the below commands are the more traditional ones for doing printing\SpecialChar \ldots{}
\layout Description
lpr Print something, you can either use it as
\emph on
lpr file
\emph default
or you can have
\emph on
lpr
\emph default
print something you input (type or redirect using <).
Obviously you can only print certain types of files, such as text files,
most programs do convert the file to postscript first to the printer-daemon
can send it.
Also try
\emph on
lp
\emph default
.
\begin_deeper
\layout Standard
To print a file simply type:
\layout Code
lpr file_name
\end_deeper
\layout Description
lpq Displays information on printer queue, including the job numbers of
print jobs.
Job numbers are required if you only want to remove a particular job using
\emph on
lrpm.
\emph default
Use
\emph on
lpq -a
\emph default
to list jobs on all printers.
\begin_deeper
\layout Standard
Example:
\layout Code
lpq
\layout Standard
This would list jobs and status on the default printer
\end_deeper
\layout Description
lprm Which removes the whole line printer queue.
To be selective about it and only delete one of the files you will need
to give
\emph on
lprm
\emph default
a job number.
\begin_deeper
\layout Standard
For example:
\layout Code
lprm job_no
\end_deeper
\layout Description
mpage
\emph on
mpage
\emph default
is used to print multiple pages onto a single page when printing.
Use the numbers 1, 2, 4 or 8 as arguments to fit between one and eight
normal pages onto a single printed page.
Use
\emph on
mpage
\emph default
with the
\emph on
-x
\emph default
option to list various commmand-line options for
\emph on
mpage
\emph default
.
\begin_deeper
\layout Standard
Example:
\layout Code
mpage 2 file.txt
\layout Standard
This will print two pages of
\begin_inset Quotes eld
\end_inset
file.txt
\begin_inset Quotes erd
\end_inset
per normal page of printing.
\end_deeper
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
mpage - candidate for removal
\layout Standard
lpstat no longer exists on Mandriva '06
\layout Description
lpstat Query the status of the printer.
Has many different options, use
\emph on
lpstat -d
\emph default
to find the default printer and
\emph on
lpstat -v
\emph default
to display information on the connected printers.
\layout Standard
Example:
\layout Code
lpstat -d
\begin_deeper
\layout Standard
Would display the status of the printers connected locally to the machine.
\end_inset
\end_inset
\layout Abstract
This document is an attempt to provide a summary of useful command-line
tools available to a GNU/Linux based operating system, the tools listed
are designed to benefit the majority of users and have being chosen at
the authors discretion.
This document is not a comprehensive list of
\emph on
every
\emph default
existent tool available to a GNU/Linux based system, nor does it have in-depth
explanations of how things work.
It is a summary which can be used to learn about and how to use many of
the tools available to a GNU/Linux based operating system.
\layout SGML
\layout SGML
\layout SGML
1.1
\layout SGML
28th February 2006
\layout SGML
CK
\layout SGML
\layout SGML
Corrected typos, generated new index (9000 index entries!).
\layout SGML
\layout SGML
\layout SGML
\layout SGML
1.0
\layout SGML
6th February 2006
\layout SGML
GA
\layout SGML
\layout SGML
Major restructuring, now in a docbook book format.
Removed large chunks of content and revised other parts (removed chapters
and sectioned some areas more).
This is likely the final release by the author, I hope that someone finds
this guide useful as I do not intend to continue work on this guide.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
0.7.1
\layout SGML
25th February 2005
\layout SGML
CK
\layout SGML
\layout SGML
Set special characters in math mode, produced PDF and PS with Computer Modern
fonts in OT1 encoding and created correct SGML for key combinations.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
0.7
\layout SGML
5th December 2004
\layout SGML
GA
\layout SGML
\layout SGML
Updated document with new grammatical review.
Re-ordered the entire Text section.
Removed a fair amount of content.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
v0.6
\layout SGML
20th April 2004
\layout SGML
GA
\layout SGML
\layout SGML
Attempted to fix document according to TLDP criticisms.
Added notes and tips more sectioning.
Now complying to the open group standards for the UNIX system trademark.
Document should be ready for TLDP site.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
v0.5
\layout SGML
6th October 2003
\layout SGML
GA
\layout SGML
\layout SGML
Fixed a variety of errors as according to the review and made some consistency
improvements to the document.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
v0.4
\layout SGML
15th July 2003
\layout SGML
GA
\layout SGML
\layout SGML
Made small improvements to the document as suggested (so far) by the thorough
TLDP review, improved consistency of document and made small content additions.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
v0.3
\layout SGML
26th June 2003
\layout SGML
GA
\layout SGML
\layout SGML
Minor errors fixed, updated the appendix with information for finding where
a tool is from.
Fixed referencing/citation problems and improved further reading and intro
sections, added an audio section.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
v0.2
\layout SGML
20th April 2003
\layout SGML
GA
\layout SGML
\layout SGML
This is the initial public release.
Added more code-style then before, broke text-section into more subsections.
Improved consistency of document and fixed various index entries.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
v0.1
\layout SGML
27th March 2003
\layout SGML
GA
\layout SGML
\layout SGML
This is the initial draft release (the first release to be converted from
LyX to DocBook SGML).
\layout SGML
\layout SGML
\layout SGML
\layout Chapter
Introduction
\begin_inset LatexCommand \label{Introduction}
\end_inset
\layout Standard
This document
\begin_inset LatexCommand \index{document}
\end_inset
is an attempt
\begin_inset LatexCommand \index{attempt}
\end_inset
to summarise
\begin_inset LatexCommand \index{summarise}
\end_inset
the many command-line-based
\begin_inset LatexCommand \index{command-line-based}
\end_inset
tools
\begin_inset LatexCommand \index{tools}
\end_inset
available
\begin_inset LatexCommand \index{available}
\end_inset
to a GNU/Linux based operating
\begin_inset LatexCommand \index{operating}
\end_inset
system.
\begin_inset LatexCommand \index{system}
\end_inset
This guide
\begin_inset LatexCommand \index{guide}
\end_inset
is not a complete
\begin_inset LatexCommand \index{complete}
\end_inset
listing (I doubt it's possible
\begin_inset LatexCommand \index{possible}
\end_inset
to document
\begin_inset LatexCommand \index{document}
\end_inset
all available
\begin_inset LatexCommand \index{available}
\end_inset
programs), this document
\begin_inset LatexCommand \index{document}
\end_inset
lists
\begin_inset LatexCommand \index{lists}
\end_inset
many tools
\begin_inset LatexCommand \index{tools}
\end_inset
which are available to GNU/Linux systems
\begin_inset LatexCommand \index{systems}
\end_inset
and which
\begin_inset LatexCommand \index{which}
\end_inset
are, or can be useful to the majority
\begin_inset LatexCommand \index{majority}
\end_inset
of users.
\begin_inset LatexCommand \index{users}
\end_inset
\layout Standard
Each tool
\begin_inset LatexCommand \index{tool}
\end_inset
description
\begin_inset LatexCommand \index{description}
\end_inset
provides a quick
\begin_inset LatexCommand \index{quick}
\end_inset
overview of it's function
\begin_inset LatexCommand \index{function}
\end_inset
and some useful options
\begin_inset LatexCommand \index{options}
\end_inset
for that individual
\begin_inset LatexCommand \index{individual}
\end_inset
tool.
\begin_inset LatexCommand \index{tool}
\end_inset
\layout Standard
The tools
\begin_inset LatexCommand \index{tools}
\end_inset
listed
\begin_inset LatexCommand \index{listed}
\end_inset
that require
\begin_inset LatexCommand \index{require}
\end_inset
a GUI,
\begin_inset LatexCommand \index{GUI}
\end_inset
usually the X windowing
\begin_inset LatexCommand \index{windowing}
\end_inset
system,
\begin_inset LatexCommand \index{system}
\end_inset
are those listed
\begin_inset LatexCommand \index{listed}
\end_inset
in the Graphics
\begin_inset LatexCommand \index{Graphics}
\end_inset
Tools section.
\begin_inset LatexCommand \index{section}
\end_inset
All other tools
\begin_inset LatexCommand \index{tools}
\end_inset
are completely command-line-based
\begin_inset LatexCommand \index{command-line-based}
\end_inset
and do not require
\begin_inset LatexCommand \index{require}
\end_inset
a GUI
\begin_inset LatexCommand \index{GUI}
\end_inset
to run.
\begin_inset LatexCommand \index{run}
\end_inset
\layout Standard
If you are looking
\begin_inset LatexCommand \index{looking}
\end_inset
for information
\begin_inset LatexCommand \index{information}
\end_inset
on GUI
\begin_inset LatexCommand \index{GUI}
\end_inset
based tools
\begin_inset LatexCommand \index{tools}
\end_inset
you will need to look
\begin_inset LatexCommand \index{look}
\end_inset
elsewhere.
\layout Standard
Also note that a few of the tools
\begin_inset LatexCommand \index{tools}
\end_inset
in this guide
\begin_inset LatexCommand \index{guide}
\end_inset
are bash
\begin_inset LatexCommand \index{bash}
\end_inset
(the Bourne-Again-SHell
\begin_inset LatexCommand \index{Bourne-Again-SHell}
\end_inset
) specific, tools
\begin_inset LatexCommand \index{tools}
\end_inset
specific
\begin_inset LatexCommand \index{specific}
\end_inset
to other shells
\begin_inset LatexCommand \index{shells}
\end_inset
are not listed
\begin_inset LatexCommand \index{listed}
\end_inset
in this document.
\begin_inset LatexCommand \index{document}
\end_inset
\layout Standard
For some of the tools
\begin_inset LatexCommand \index{tools}
\end_inset
that are harder to use, or perform
\begin_inset LatexCommand \index{perform}
\end_inset
a more
\begin_inset LatexCommand \index{more}
\end_inset
complex
\begin_inset LatexCommand \index{complex}
\end_inset
task,
\begin_inset LatexCommand \index{task}
\end_inset
there are several
\begin_inset LatexCommand \index{several}
\end_inset
mini-tutorials
\begin_inset LatexCommand \index{mini-tutorials}
\end_inset
(or mini-guides;
\begin_inset LatexCommand \index{mini-guides}
\end_inset
\begin_inset LatexCommand \ref{Mini-guides}
\end_inset
) within this document.
\begin_inset LatexCommand \index{document}
\end_inset
\layout Standard
Where a mini-guide
\begin_inset LatexCommand \index{mini-guide}
\end_inset
was considered unncessary,
\begin_inset LatexCommand \index{unncessary}
\end_inset
detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
descriptions that explain
\begin_inset LatexCommand \index{explain}
\end_inset
in detail
\begin_inset LatexCommand \index{detail}
\end_inset
how a particular
\begin_inset LatexCommand \index{particular}
\end_inset
tool
\begin_inset LatexCommand \index{tool}
\end_inset
works,
\begin_inset LatexCommand \index{works}
\end_inset
and some examples
\begin_inset LatexCommand \index{examples}
\end_inset
of how to use it are provided.
\begin_inset LatexCommand \index{provided}
\end_inset
\layout Standard
Please note that the word
\begin_inset LatexCommand \index{word}
\end_inset
\begin_inset Quotes eld
\end_inset
tool
\begin_inset Quotes erd
\end_inset
is used interchangeably
\begin_inset LatexCommand \index{interchangeably}
\end_inset
with the word
\begin_inset LatexCommand \index{word}
\end_inset
\begin_inset Quotes eld
\end_inset
command
\begin_inset Quotes erd
\end_inset
, both have the same meaning
\begin_inset LatexCommand \index{meaning}
\end_inset
(at least
\begin_inset LatexCommand \index{least}
\end_inset
in this guide).
For a more
\begin_inset LatexCommand \index{more}
\end_inset
detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
explanation, read
\begin_inset LatexCommand \index{read}
\end_inset
about the UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
Tools Philosophy
\begin_inset LatexCommand \index{Philosophy}
\end_inset
here:
\begin_inset LatexCommand \ref{The-UNIX-Tools-Philosophy}
\end_inset
or visit
\begin_inset LatexCommand \index{visit}
\end_inset
the links
\begin_inset LatexCommand \index{links}
\end_inset
in the appendix,
\begin_inset LatexCommand \index{appendix}
\end_inset
\begin_inset LatexCommand \ref{unix-tools-further-reading}
\end_inset
.
\layout SGML
\layout SGML
To find out which tools are bash specific
\layout SGML
To find out which tools are bash specific you can type:
\layout SGML
enable -a
\layout SGML
\layout SGML
\layout Section
Formats
\begin_inset LatexCommand \label{formats}
\end_inset
\layout Standard
This document
\begin_inset LatexCommand \index{document}
\end_inset
is available
\begin_inset LatexCommand \index{available}
\end_inset
in the following
\begin_inset LatexCommand \index{following}
\end_inset
formats:
\begin_inset LatexCommand \index{formats}
\end_inset
\layout Itemize
\begin_inset LatexCommand \url[HTML (HyperText Markup Language)]{./book1.html}
\end_inset
, many HTML
\begin_inset LatexCommand \index{HTML}
\end_inset
files,
\begin_inset LatexCommand \index{files}
\end_inset
one per section,
\begin_inset LatexCommand \index{section}
\end_inset
for viewing
\begin_inset LatexCommand \index{viewing}
\end_inset
with
\begin_inset LatexCommand \url[any browser]{https://www.anybrowser.org/campaign/}
\end_inset
\layout Itemize
\begin_inset LatexCommand \url[HTML (HyperText Markup Language)]{./gnu-linux-tools-summary.html}
\end_inset
, one big HTML
\begin_inset LatexCommand \index{HTML}
\end_inset
file
\layout Itemize
\begin_inset LatexCommand \url[TXT (ASCII Text)]{./gnu-linux-tools-summary.txt}
\end_inset
\layout Itemize
\begin_inset LatexCommand \url[RTF (Rich Text Format)]{./gnu-linux-tools-summary.rtf}
\end_inset
\layout Itemize
\begin_inset LatexCommand \url[PDF (Portable Document Format)]{./gnu-linux-tools-summary.pdf}
\end_inset
\layout Itemize
\begin_inset LatexCommand \url[PS.GZ (Compressed Postscript)]{./gnu-linux-tools-summary.ps.gz}
\end_inset
\layout Itemize
\begin_inset LatexCommand \url[SGML (Standard Generalized Markup Language)]{./gnu-linux-tools-summary.sgml}
\end_inset
(with the
\begin_inset LatexCommand \url[Appendix]{appendix.sgml}
\end_inset
and the
\begin_inset LatexCommand \url[Bibliography]{bibliography.sgml}
\end_inset
)
\layout Itemize
\begin_inset LatexCommand \url[LYX (LaTeX frontend LyX)]{./gnu-linux-tools-summary.lyx}
\end_inset
(with the
\begin_inset LatexCommand \url[Appendix]{appendix.lyx}
\end_inset
and the
\begin_inset LatexCommand \url[Bibliography]{bibliography.lyx}
\end_inset
)
\layout SGML
\layout SGML
RTF: Page numbers
\layout SGML
In order to get correct page numbers (and often to get the images
working) in Microsoft Word, type the following after opening the document:
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
CTRL
\layout SGML
END
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
CTRL
\layout SGML
A
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
F9
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
In Word Viewer 97, you must instead do:
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
CTRL
\layout SGML
END
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
ALT
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
V
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
N
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
ALT
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
V
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
P
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
See The
OpenJade RTF backend for more details.
\layout SGML
\layout SGML
\layout SGML
Important: Downloads for offline reading!
\layout SGML
\layout SGML
If you want to download the HTML or RTF formats for offline reading, you
will need to download the images as well - PNG for HTML and BMP for RTF,
including the callouts! To save you the hassle, I have compiled the following
gzipped tar archives for offline reading:
\layout SGML
\layout SGML
\layout Itemize
\begin_inset LatexCommand \url[ TAR.GZ (Compressed TAR Archive), many HTML files with images]{./gnu-linux-tools-summary-html.tar.gz}
\end_inset
\layout Itemize
\begin_inset LatexCommand \url[ TAR.GZ (Compressed TAR Archive), one big HTML file with images]{./gnu-linux-tools-summary-onehtml.tar.gz}
\end_inset
\layout Itemize
\begin_inset LatexCommand \url[ TAR.GZ (Compressed TAR Archive), SGML file with images]{./gnu-linux-tools-summary-sgml.tar.gz}
\end_inset
\layout Itemize
\begin_inset LatexCommand \url[ TAR.GZ (Compressed TAR Archive), RTF file with images]{./gnu-linux-tools-summary-rtf.tar.gz}
\end_inset
\layout Standard
A tarball
\begin_inset LatexCommand \index{tarball}
\end_inset
containing all the above is also available:
\begin_inset LatexCommand \index{available}
\end_inset
\layout Itemize
\begin_inset LatexCommand \url[ TAR.GZ (Compressed TAR Archive), All files]{./gnu-linux-tools-summary.tar.gz}
\end_inset
\layout Section
Who would want to read this guide?
\begin_inset LatexCommand \label{who-would-want-to-read-this-guide}
\end_inset
\layout Standard
Anyone who is interested in learning
\begin_inset LatexCommand \index{learning}
\end_inset
about the tools
\begin_inset LatexCommand \index{tools}
\end_inset
(also known as commands) available
\begin_inset LatexCommand \index{available}
\end_inset
to them when using their GNU/Linux based operating
\begin_inset LatexCommand \index{operating}
\end_inset
system.
\begin_inset LatexCommand \index{system}
\end_inset
\layout Standard
Why would you want to learn
\begin_inset LatexCommand \index{learn}
\end_inset
how to use the command
\begin_inset LatexCommand \index{command}
\end_inset
line (and available
\begin_inset LatexCommand \index{available}
\end_inset
tools)? The
\series bold
\emph on
C
\emph default
ommand
\emph on
L
\emph default
ine
\emph on
I
\emph default
nterface
\series default
(CLI), while difficult to learn,
\begin_inset LatexCommand \index{learn}
\end_inset
is the quickest
\begin_inset LatexCommand \index{quickest}
\end_inset
and most efficient
\begin_inset LatexCommand \index{efficient}
\end_inset
way to use a computer
\begin_inset LatexCommand \index{computer}
\end_inset
for many different
\begin_inset LatexCommand \index{different}
\end_inset
tasks.
\begin_inset LatexCommand \index{tasks}
\end_inset
The CLI
\begin_inset LatexCommand \index{CLI}
\end_inset
is the normal
\begin_inset LatexCommand \index{normal}
\end_inset
method of use for most UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
administrators,
\begin_inset LatexCommand \index{administrators}
\end_inset
programmers
\begin_inset LatexCommand \index{programmers}
\end_inset
and some power
\begin_inset LatexCommand \index{power}
\end_inset
users.
While a GUI
\begin_inset LatexCommand \index{GUI}
\end_inset
is better suited
\begin_inset LatexCommand \index{suited}
\end_inset
to some tasks,
\begin_inset LatexCommand \index{tasks}
\end_inset
many operations
\begin_inset LatexCommand \index{operations}
\end_inset
are best suited to the CLI.
\begin_inset LatexCommand \index{CLI}
\end_inset
\layout Standard
The major
\begin_inset LatexCommand \index{major}
\end_inset
motivation behind learning
\begin_inset LatexCommand \index{learning}
\end_inset
the GNU/Linux CLI
\begin_inset LatexCommand \index{CLI}
\end_inset
is the authors
\begin_inset LatexCommand \index{authors}
\end_inset
idea
\begin_inset LatexCommand \index{idea}
\end_inset
that, with software
\begin_inset LatexCommand \index{software}
\end_inset
in general,
\begin_inset LatexCommand \index{general}
\end_inset
the more
\begin_inset LatexCommand \index{more}
\end_inset
time
\begin_inset LatexCommand \index{time}
\end_inset
spent learning
\begin_inset LatexCommand \index{learning}
\end_inset
something equals
\begin_inset LatexCommand \index{equals}
\end_inset
less
\begin_inset LatexCommand \index{less}
\end_inset
time
\begin_inset LatexCommand \index{time}
\end_inset
spent performing
\begin_inset LatexCommand \index{performing}
\end_inset
that particular
\begin_inset LatexCommand \index{particular}
\end_inset
task
\begin_inset LatexCommand \index{task}
\end_inset
\emph on
(authors opinion
\begin_inset LatexCommand \index{opinion}
\end_inset
only)
\emph default
.
\layout Standard
This guide
\begin_inset LatexCommand \index{guide}
\end_inset
is aimed at beginners
\begin_inset LatexCommand \index{beginners}
\end_inset
to intermediate
\begin_inset LatexCommand \index{intermediate}
\end_inset
users who want to learn
\begin_inset LatexCommand \index{learn}
\end_inset
about the commandline
\begin_inset LatexCommand \index{commandline}
\end_inset
tools available
\begin_inset LatexCommand \index{available}
\end_inset
to them.
Advanced users
\begin_inset LatexCommand \index{users}
\end_inset
may wish to use it as a command
\begin_inset LatexCommand \index{command}
\end_inset
reference,
\begin_inset LatexCommand \index{reference}
\end_inset
however this document
\begin_inset LatexCommand \index{document}
\end_inset
aims to list
\begin_inset LatexCommand \index{list}
\end_inset
commands
\begin_inset LatexCommand \index{commands}
\end_inset
of interest, as judged
\begin_inset LatexCommand \index{judged}
\end_inset
by the authors
\begin_inset LatexCommand \index{authors}
\end_inset
opinion,
\begin_inset LatexCommand \index{opinion}
\end_inset
it is not designed
\begin_inset LatexCommand \index{designed}
\end_inset
to be completely comprehensive,
\begin_inset LatexCommand \index{comprehensive}
\end_inset
see the appendix,
\begin_inset LatexCommand \index{appendix}
\end_inset
\begin_inset LatexCommand \ref{general-further-reading}
\end_inset
for further information.
\begin_inset LatexCommand \index{information}
\end_inset
Or if you are not looking
\begin_inset LatexCommand \index{looking}
\end_inset
for a command
\begin_inset LatexCommand \index{command}
\end_inset
reference
\begin_inset LatexCommand \index{reference}
\end_inset
guide, but a more
\begin_inset LatexCommand \index{more}
\end_inset
gentle
\begin_inset LatexCommand \index{gentle}
\end_inset
introduction
\begin_inset LatexCommand \index{introduction}
\end_inset
to GNU/Linux you may be interested in the
\begin_inset LatexCommand \url[Introduction to Linux guide]{https://www.tldp.org/LDP/intro-linux/html/}
\end_inset
authored
\begin_inset LatexCommand \index{authored}
\end_inset
by Machtelt Garrels.
\begin_inset LatexCommand \index{Garrels}
\end_inset
\layout Standard
This guide
\begin_inset LatexCommand \index{guide}
\end_inset
could also be considered a summarised
\begin_inset LatexCommand \index{summarised}
\end_inset
version
\begin_inset LatexCommand \index{version}
\end_inset
of the Linux
\begin_inset LatexCommand \index{Linux}
\end_inset
Cookbook.
\begin_inset LatexCommand \index{Cookbook}
\end_inset
If you are looking
\begin_inset LatexCommand \index{looking}
\end_inset
for a book
\begin_inset LatexCommand \index{book}
\end_inset
with more
\begin_inset LatexCommand \index{more}
\end_inset
detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
descriptions of each tool
\begin_inset LatexCommand \index{tool}
\end_inset
have a look
\begin_inset LatexCommand \index{look}
\end_inset
at the
\begin_inset LatexCommand \url[Linux Cookbook Homepage]{https://dsl.org/cookbook/}
\end_inset
, also check
\begin_inset LatexCommand \index{check}
\end_inset
out the
\begin_inset LatexCommand \url[command list from "Linux in a Nutshell 3rd Edition"]{https://www.onlamp.com/linux/cmd/}
\end_inset
for an index
\begin_inset LatexCommand \index{index}
\end_inset
of 300+ commands
\begin_inset LatexCommand \index{commands}
\end_inset
and their explanations.
\begin_inset LatexCommand \index{explanations}
\end_inset
\layout Section
Who would not want to read this guide?
\begin_inset LatexCommand \label{who-would-not-want-to-read-this-guide}
\end_inset
\layout Standard
Anyone who is not interested in the command
\begin_inset LatexCommand \index{command}
\end_inset
line, or anyone looking
\begin_inset LatexCommand \index{looking}
\end_inset
for a detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
reference
\begin_inset LatexCommand \index{reference}
\end_inset
to all available
\begin_inset LatexCommand \index{available}
\end_inset
GNU/Linux tools
\begin_inset LatexCommand \index{tools}
\end_inset
should look
\begin_inset LatexCommand \index{look}
\end_inset
elsewhere.
This is only a summary,
\begin_inset LatexCommand \index{summary}
\end_inset
while it does list
\begin_inset LatexCommand \index{list}
\end_inset
many commands,
\begin_inset LatexCommand \index{commands}
\end_inset
it's not a complete
\begin_inset LatexCommand \index{complete}
\end_inset
listing
\begin_inset LatexCommand \index{listing}
\end_inset
(I don't think it's possible
\begin_inset LatexCommand \index{possible}
\end_inset
to make a complete
\begin_inset LatexCommand \index{complete}
\end_inset
listing anyway).
\layout Standard
This document
\begin_inset LatexCommand \index{document}
\end_inset
would not be unlikely
\begin_inset LatexCommand \index{unlikely}
\end_inset
to be of interest to those who already have an expert
\begin_inset LatexCommand \index{expert}
\end_inset
knowledge
\begin_inset LatexCommand \index{knowledge}
\end_inset
of the command
\begin_inset LatexCommand \index{command}
\end_inset
line interface
\begin_inset LatexCommand \index{interface}
\end_inset
and do require
\begin_inset LatexCommand \index{require}
\end_inset
any reference
\begin_inset LatexCommand \index{reference}
\end_inset
information.
\begin_inset LatexCommand \index{information}
\end_inset
Or those readers
\begin_inset LatexCommand \index{readers}
\end_inset
who require
\begin_inset LatexCommand \index{require}
\end_inset
detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
lists
\begin_inset LatexCommand \index{lists}
\end_inset
of options
\begin_inset LatexCommand \index{options}
\end_inset
for each command,
\begin_inset LatexCommand \index{command}
\end_inset
the man
\begin_inset LatexCommand \index{man}
\end_inset
pages
\begin_inset LatexCommand \index{pages}
\end_inset
are better suited
\begin_inset LatexCommand \index{suited}
\end_inset
to this purpose.
\begin_inset LatexCommand \index{purpose}
\end_inset
\layout Section
Availability of sources
\begin_inset LatexCommand \label{sources-of-document}
\end_inset
\layout Standard
The modifiable
\begin_inset LatexCommand \index{modifiable}
\end_inset
sources
\begin_inset LatexCommand \index{sources}
\end_inset
of the original
\begin_inset LatexCommand \index{original}
\end_inset
book
\begin_inset LatexCommand \index{book}
\end_inset
(in english), are available
\begin_inset LatexCommand \index{available}
\end_inset
in LyX
\begin_inset LatexCommand \index{LyX}
\end_inset
format
\begin_inset LatexCommand \index{format}
\end_inset
(LyX Document
\begin_inset LatexCommand \index{Document}
\end_inset
Processor) or Machine-translated
\begin_inset LatexCommand \index{Machine-translated}
\end_inset
SGML
\begin_inset LatexCommand \index{SGML}
\end_inset
(SGML markup
\begin_inset LatexCommand \index{markup}
\end_inset
language).
\layout Standard
LyX
\begin_inset LatexCommand \index{LyX}
\end_inset
is a completely free
\begin_inset LatexCommand \index{free}
\end_inset
document processor
\begin_inset LatexCommand \index{processor}
\end_inset
based on LaTeX,
\begin_inset LatexCommand \index{LaTeX}
\end_inset
downloadable
\begin_inset LatexCommand \index{downloadable}
\end_inset
from
\begin_inset LatexCommand \url[the LyX homepage.]{https://www.lyx.org}
\end_inset
.
\layout Standard
See
\begin_inset LatexCommand \ref{formats}
\end_inset
for the modifiable
\begin_inset LatexCommand \index{modifiable}
\end_inset
sources
\begin_inset LatexCommand \index{sources}
\end_inset
of this document.
\begin_inset LatexCommand \index{document}
\end_inset
These are the official
\begin_inset LatexCommand \index{official}
\end_inset
versions.
\begin_inset LatexCommand \index{versions}
\end_inset
We (the translators
\begin_inset LatexCommand \index{translators}
\end_inset
and current
\begin_inset LatexCommand \index{current}
\end_inset
maintainers) plan
\begin_inset LatexCommand \index{plan}
\end_inset
to continue work
\begin_inset LatexCommand \index{work}
\end_inset
on this document
\begin_inset LatexCommand \index{document}
\end_inset
and add
\begin_inset LatexCommand \index{add}
\end_inset
new
\begin_inset LatexCommand \index{new}
\end_inset
chapters and enhancements.
\begin_inset LatexCommand \index{enhancements}
\end_inset
If you want to see the version
\begin_inset LatexCommand \index{version}
\end_inset
we are currently working
\begin_inset LatexCommand \index{working}
\end_inset
on (the "bleeding edge" version), check
\begin_inset LatexCommand \index{check}
\end_inset
the
\begin_inset LatexCommand \url[GNU/Linux Command-Line Tools Summary Homepage]{https://www.karakas-online.de/gnu-linux-tools-summary/}
\end_inset
from time
\begin_inset LatexCommand \index{time}
\end_inset
to time
\begin_inset LatexCommand \index{time}
\end_inset
(kindly hosted
\begin_inset LatexCommand \index{hosted}
\end_inset
by
\begin_inset LatexCommand \url[Chris Karakas]{https://www.karakas-online.de}
\end_inset
).
\layout Section
Conventions used in this guide
\begin_inset LatexCommand \label{conventions}
\end_inset
\layout Standard
\family sans
\begin_inset LatexCommand \index{sans}
\end_inset
\series medium
The following
\begin_inset LatexCommand \index{following}
\end_inset
conventions
\begin_inset LatexCommand \index{conventions}
\end_inset
are used within this guide:
\begin_inset LatexCommand \index{guide}
\end_inset
\layout Description
italic
\begin_inset LatexCommand \index{italic}
\end_inset
Anything appearing in italic,
\emph on
like\SpecialChar ~
this
\emph default
is either an executable
\begin_inset LatexCommand \index{executable}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
or emphasized
\begin_inset LatexCommand \index{emphasized}
\end_inset
text.
\begin_inset LatexCommand \index{text}
\end_inset
\begin_deeper
\layout Standard
Tools
\begin_inset LatexCommand \index{Tools}
\end_inset
(executable commands) are in italics
\begin_inset LatexCommand \index{italics}
\end_inset
to prevent
\begin_inset LatexCommand \index{prevent}
\end_inset
confusion.
Some tools
\begin_inset LatexCommand \index{tools}
\end_inset
have names which
\begin_inset LatexCommand \index{which}
\end_inset
are real
\begin_inset LatexCommand \index{real}
\end_inset
english
\begin_inset LatexCommand \index{english}
\end_inset
words,
\begin_inset LatexCommand \index{words}
\end_inset
such as the
\begin_inset Quotes eld
\end_inset
locate
\begin_inset Quotes erd
\end_inset
tool.
\begin_inset LatexCommand \index{tool}
\end_inset
\end_deeper
\layout Description
key\SpecialChar ~
combinations
\begin_inset LatexCommand \index{combinations}
\end_inset
Are represented
\begin_inset LatexCommand \index{represented}
\end_inset
by using a '-' (dash sign) inbetween the key(s), which
\begin_inset LatexCommand \index{which}
\end_inset
must
\begin_inset LatexCommand \index{must}
\end_inset
be used in combination.
\begin_inset LatexCommand \index{combination}
\end_inset
All combinations
\begin_inset LatexCommand \index{combinations}
\end_inset
are also printed
\begin_inset LatexCommand \index{printed}
\end_inset
in italics
\begin_inset LatexCommand \index{italics}
\end_inset
to improve
\begin_inset LatexCommand \index{improve}
\end_inset
clarity.
\begin_inset LatexCommand \index{clarity}
\end_inset
For example
\begin_inset LatexCommand \index{example}
\end_inset
CTRL-Z means hold down the
\emph on
Control
\begin_inset LatexCommand \index{Control}
\end_inset
key
\begin_inset LatexCommand \index{key}
\end_inset
\emph default
and press
\begin_inset LatexCommand \index{press}
\end_inset
the
\emph on
z
\emph default
\emph on
key.
\layout Description
admonitions
\begin_inset LatexCommand \index{admonitions}
\end_inset
Admonitions are little pictures
\begin_inset LatexCommand \index{pictures}
\end_inset
used to emphasize
\begin_inset LatexCommand \index{emphasize}
\end_inset
something of importance
\begin_inset LatexCommand \index{importance}
\end_inset
to the reader.
\begin_inset LatexCommand \index{reader}
\end_inset
\begin_deeper
\layout Standard
The five
\begin_inset LatexCommand \index{five}
\end_inset
types used are:
\layout SGML
\layout SGML
This is a note
\layout SGML
\layout SGML
Notes often give important information about a tool.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
This is a tip
\layout SGML
\layout SGML
This will offer a useful switch or useful way to use a tool.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
This is something important
\layout SGML
\layout SGML
This is something that is considered very important.
Consider it like a note with extra importance, they are usually there to
save the reader time.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
This is a caution
\layout SGML
\layout SGML
This will inform you of something that you be careful about (because it
could be harmful to your system).
\layout SGML
\layout SGML
\layout SGML
\layout SGML
This is a warning
\layout SGML
\layout SGML
This will inform you of something that you shouldn't do (because it probably
will break something within your system).
\layout SGML
\layout SGML
\end_deeper
\layout Description
code\SpecialChar ~
examples Code
\begin_inset LatexCommand \index{Code}
\end_inset
examples
\begin_inset LatexCommand \index{examples}
\end_inset
are shown
\begin_inset LatexCommand \index{shown}
\end_inset
for most commands.
\begin_inset LatexCommand \index{commands}
\end_inset
\begin_deeper
\layout Standard
Below is an example
\begin_inset LatexCommand \index{example}
\end_inset
of what code
\begin_inset LatexCommand \index{code}
\end_inset
looks like:
\layout Code
Hello World, I'm a code example.
:)
\end_deeper
\layout Description
command\SpecialChar ~
syntax
\begin_inset LatexCommand \index{syntax}
\end_inset
(or a similar
\begin_inset LatexCommand \index{similar}
\end_inset
phrase) simply shows
\begin_inset LatexCommand \index{shows}
\end_inset
how you would normally use the command.
\begin_inset LatexCommand \index{command}
\end_inset
Often real
\begin_inset LatexCommand \index{real}
\end_inset
examples
\begin_inset LatexCommand \index{examples}
\end_inset
are used instead of explaining
\begin_inset LatexCommand \index{explaining}
\end_inset
the command
\begin_inset LatexCommand \index{command}
\end_inset
syntax.
\begin_inset LatexCommand \index{syntax}
\end_inset
\begin_deeper
\layout Standard
The phrase
\begin_inset LatexCommand \index{phrase}
\end_inset
\begin_inset Quotes eld
\end_inset
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax
\begin_inset Quotes erd
\end_inset
is always followed
\begin_inset LatexCommand \index{followed}
\end_inset
by the way you would type a command
\begin_inset LatexCommand \index{command}
\end_inset
in a shell.
\begin_inset LatexCommand \index{shell}
\end_inset
\layout Standard
The standard
\begin_inset LatexCommand \index{standard}
\end_inset
syntax
\begin_inset LatexCommand \index{syntax}
\end_inset
for any tool
\begin_inset LatexCommand \index{tool}
\end_inset
is usually:
\layout Code
command -options file
\layout SGML
\layout SGML
Note
\layout SGML
Note that some tools do not accept options.
\layout SGML
\end_deeper
\layout Description
wildcards
\begin_inset LatexCommand \index{wildcards}
\end_inset
Also note that most commands,
\begin_inset LatexCommand \index{commands}
\end_inset
even
\begin_inset LatexCommand \index{even}
\end_inset
when not explicitly
\begin_inset LatexCommand \index{explicitly}
\end_inset
stated,
\begin_inset LatexCommand \index{stated}
\end_inset
will work
\begin_inset LatexCommand \index{work}
\end_inset
with standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
(or globbing
\begin_inset LatexCommand \index{globbing}
\end_inset
patterns) such as *, [A-Z] and various other standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards.
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
Refer
\begin_inset LatexCommand \index{Refer}
\end_inset
to
\begin_inset LatexCommand \ref{standard-wildcards}
\end_inset
for further information.
\begin_inset LatexCommand \index{information}
\end_inset
\layout Description
access\SpecialChar ~
keys
\begin_inset LatexCommand \index{keys}
\end_inset
Access
\begin_inset LatexCommand \index{Access}
\end_inset
keys enable
\begin_inset LatexCommand \index{enable}
\end_inset
navigation through the document,
\begin_inset LatexCommand \index{document}
\end_inset
without relying on a mouse.
\begin_inset LatexCommand \index{mouse}
\end_inset
The following
\begin_inset LatexCommand \index{following}
\end_inset
keys have been given special
\begin_inset LatexCommand \index{special}
\end_inset
meaning
\begin_inset LatexCommand \index{meaning}
\end_inset
in this document:
\begin_inset LatexCommand \index{document}
\end_inset
\begin_deeper
\layout Description
P Previous
\begin_inset LatexCommand \index{Previous}
\end_inset
page.
\begin_inset LatexCommand \index{page}
\end_inset
\layout Description
N Next
\begin_inset LatexCommand \index{Next}
\end_inset
page.
\begin_inset LatexCommand \index{page}
\end_inset
\layout Description
H Home
\begin_inset LatexCommand \index{Home}
\end_inset
of the document
\begin_inset LatexCommand \index{document}
\end_inset
(Table of Contents).
\layout Description
U Up (takes you one level
\begin_inset LatexCommand \index{level}
\end_inset
up the section
\begin_inset LatexCommand \index{section}
\end_inset
hierarchy).
\layout Standard
If you also happen to be reading
\begin_inset LatexCommand \index{reading}
\end_inset
the document
\begin_inset LatexCommand \index{document}
\end_inset
from its original
\begin_inset LatexCommand \index{original}
\end_inset
location,
\begin_inset LatexCommand \index{location}
\end_inset
then the following
\begin_inset LatexCommand \index{following}
\end_inset
access
\begin_inset LatexCommand \index{access}
\end_inset
keys can also be used:
\layout Description
S Start
\begin_inset LatexCommand \index{Start}
\end_inset
(takes you to the author's start
\begin_inset LatexCommand \index{start}
\end_inset
page).
\layout Description
T The current
\begin_inset LatexCommand \index{current}
\end_inset
(
\begin_inset Quotes eld
\end_inset
This
\begin_inset Quotes erd
\end_inset
) page,
\begin_inset LatexCommand \index{page}
\end_inset
without the Sitemenu
\begin_inset LatexCommand \index{Sitemenu}
\end_inset
on the left.
\begin_inset LatexCommand \index{left}
\end_inset
\layout Description
M The current
\begin_inset LatexCommand \index{current}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
in a frameset,
\begin_inset LatexCommand \index{frameset}
\end_inset
where the left
\begin_inset LatexCommand \index{left}
\end_inset
frame
\begin_inset LatexCommand \index{frame}
\end_inset
contains a Menu.
\begin_inset LatexCommand \index{Menu}
\end_inset
\end_deeper
\layout SGML
\layout SGML
To use the access keys, you have to simultaneously press a modifier key,
which may vary from browser to browser.
For example in NN6+/Mozilla, the modifier key is ALT,
so you have to use
\layout SGML
\layout SGML
ALT
\layout SGML
N
\layout SGML
\layout SGML
to go to the next page, and
\layout SGML
\layout SGML
ALT
\layout SGML
P
\layout SGML
\layout SGML
to come back.
In other browsers such as IE6, the access keys just give focus to the associate
d link, so the sequence becomes
\layout SGML
\layout SGML
\layout SGML
ALT
\layout SGML
N
\layout SGML
\layout SGML
Enter
\layout SGML
\layout SGML
.
Try it, you'll like it!
]]> ]]> ]]> ]]> Inline graphic
\layout Section
Resources used to create this document
\begin_inset LatexCommand \label{resources-used-to-create-this-document}
\end_inset
\layout Standard
To create the GNU/Linux Command-Line
\begin_inset LatexCommand \index{Command-Line}
\end_inset
Tools Summary,
\begin_inset LatexCommand \index{Summary}
\end_inset
I used
\begin_inset LatexCommand \url[LyX]{https://www.lyx.org}
\end_inset
, the document
\begin_inset LatexCommand \index{document}
\end_inset
processor.
\begin_inset LatexCommand \index{processor}
\end_inset
To convert
\begin_inset LatexCommand \index{convert}
\end_inset
the LyX
\begin_inset LatexCommand \index{LyX}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
to DocBook
\begin_inset LatexCommand \index{DocBook}
\end_inset
SGML
\begin_inset LatexCommand \index{SGML}
\end_inset
I used the
\begin_inset LatexCommand \url[LyX-to-X Scripts]{https://www.karakas-online.de/mySGML/}
\end_inset
created by
\begin_inset LatexCommand \url[Chris Karakas]{https://www.karakas-online.de}
\end_inset
.
\begin_inset LatexCommand \index{Karakas, Chris}
\end_inset
\layout Standard
You may also want to check
\begin_inset LatexCommand \index{check}
\end_inset
out the
\begin_inset LatexCommand \url[db2lyx ]{https://bgu.chez.tiscali.fr/}
\end_inset
package,
\begin_inset LatexCommand \index{package}
\end_inset
created by Dr.
B Guillion,
\begin_inset LatexCommand \index{Guillion, B. Dr.}
\end_inset
which
\begin_inset LatexCommand \index{which}
\end_inset
can be used to convert
\begin_inset LatexCommand \index{convert}
\end_inset
LyX files
\begin_inset LatexCommand \index{files}
\end_inset
to XML
\begin_inset LatexCommand \index{XML}
\end_inset
DocBook and XML DocBook
\begin_inset LatexCommand \index{DocBook}
\end_inset
to LyX.
\begin_inset LatexCommand \index{LyX}
\end_inset
\layout Standard
I also had assistance
\begin_inset LatexCommand \index{assistance}
\end_inset
from various
\begin_inset LatexCommand \url[The Linux Documentation Project]{https://www.tldp.org}
\end_inset
volunteers
\begin_inset LatexCommand \index{volunteers}
\end_inset
(see the contributors
\begin_inset LatexCommand \index{contributors}
\end_inset
section
\begin_inset LatexCommand \index{section}
\end_inset
\begin_inset LatexCommand \ref{contributors}
\end_inset
for specific
\begin_inset LatexCommand \index{specific}
\end_inset
details).
\layout Section
Feedback
\begin_inset LatexCommand \label{feedback}
\end_inset
\layout Standard
Feedback
\begin_inset LatexCommand \index{Feedback}
\end_inset
is necessary for the advancement
\begin_inset LatexCommand \index{advancement}
\end_inset
of this guide.
\begin_inset LatexCommand \index{guide}
\end_inset
Positive,
\begin_inset LatexCommand \index{Positive}
\end_inset
constructive criticism
\begin_inset LatexCommand \index{criticism}
\end_inset
is encouraged.
\begin_inset LatexCommand \index{encouraged}
\end_inset
If you have ideas,
\begin_inset LatexCommand \index{ideas}
\end_inset
suggestions,
\begin_inset LatexCommand \index{suggestions}
\end_inset
advice,
\begin_inset LatexCommand \index{advice}
\end_inset
or problems
\begin_inset LatexCommand \index{problems}
\end_inset
with this guide,
\begin_inset LatexCommand \index{guide}
\end_inset
please send
\begin_inset LatexCommand \index{send}
\end_inset
an email
\begin_inset LatexCommand \index{email}
\end_inset
to the author
\begin_inset LatexCommand \index{author}
\end_inset
\begin_inset LatexCommand \url[Gareth Anderson]{mailto:somecsstudent(at)gmail.com}
\end_inset
.
\begin_inset LatexCommand \index{Anderson, Gareth}
\end_inset
\layout SGML
\begin_inset Note
collapsed true
\layout Standard
changed to this weird style to stop the paragraph of this note becoming
a footnote.
Still footnote! --now added something above to try to stop footnote.
(will be in version 0.6)--fixed by chris.
\layout Standard
Seems to work now
\end_inset
\layout SGML
Contributions
\layout SGML
\layout SGML
If you wish to make contributions it is recommended (if possible) to read
the LyX file(s) for this document.
They contain various notes which you can't see in the other versions.
\layout SGML
These notes highlight the areas that need contributions, certain tools
which I cannot understand, tools which have not been added, or tools which
were removed.
These notes also explain some of the structure of this document.
\layout SGML
\layout SGML
\layout Section
Contributors
\begin_inset LatexCommand \label{contributors}
\end_inset
\layout Standard
As you may be able
\begin_inset LatexCommand \index{able}
\end_inset
to see, parts
\begin_inset LatexCommand \index{parts}
\end_inset
of this guide
\begin_inset LatexCommand \index{guide}
\end_inset
are based off
\begin_inset LatexCommand \index{off}
\end_inset
various advice
\begin_inset LatexCommand \index{advice}
\end_inset
columns
\begin_inset LatexCommand \index{columns}
\end_inset
on GNU/Linux, anything that has being directly quoted
\begin_inset LatexCommand \index{quoted}
\end_inset
from an article
\begin_inset LatexCommand \index{article}
\end_inset
can be found
\begin_inset LatexCommand \index{found}
\end_inset
in the references,
\begin_inset LatexCommand \index{references}
\end_inset
\begin_inset LatexCommand \ref{references}
\end_inset
, section
\begin_inset LatexCommand \index{section}
\end_inset
of this document.
\begin_inset LatexCommand \index{document}
\end_inset
\layout Standard
The following
\begin_inset LatexCommand \index{following}
\end_inset
is a list
\begin_inset LatexCommand \index{list}
\end_inset
of people
\begin_inset LatexCommand \index{people}
\end_inset
who have made a significant
\begin_inset LatexCommand \index{significant}
\end_inset
contribution
\begin_inset LatexCommand \index{contribution}
\end_inset
to this document,
\begin_inset LatexCommand \index{document}
\end_inset
in a rough
\begin_inset LatexCommand \index{rough}
\end_inset
chronological
\begin_inset LatexCommand \index{chronological}
\end_inset
order.
\layout Description
\begin_inset LatexCommand \url[Chris Karakas]{https://www.karakas-online.de}
\end_inset
: Chris
\begin_inset LatexCommand \index{Karakas, Chris}
\end_inset
allowed
\begin_inset LatexCommand \index{allowed}
\end_inset
the use of his lyxtox
\begin_inset LatexCommand \index{lyxtox}
\end_inset
scripts
\begin_inset LatexCommand \index{scripts}
\end_inset
to convert
\begin_inset LatexCommand \index{convert}
\end_inset
the LyX
\begin_inset LatexCommand \index{LyX}
\end_inset
file of the document
\begin_inset LatexCommand \index{document}
\end_inset
to working
\begin_inset LatexCommand \index{working}
\end_inset
DocBook SGML
\begin_inset LatexCommand \index{SGML}
\end_inset
output (to learn
\begin_inset LatexCommand \index{learn}
\end_inset
how to use the lyxtox
\begin_inset LatexCommand \index{lyxtox}
\end_inset
scripts
\begin_inset LatexCommand \index{scripts}
\end_inset
yourself, see
\begin_inset LatexCommand \url[Document processing with LyX and SGML]{https://www.karakas-online.de/mySGML/}
\end_inset
).
\begin_deeper
\layout Itemize
Chris provided
\begin_inset LatexCommand \index{provided}
\end_inset
useful suggestions
\begin_inset LatexCommand \index{suggestions}
\end_inset
and advice,
\begin_inset LatexCommand \index{advice}
\end_inset
and added an index
\begin_inset LatexCommand \index{index}
\end_inset
listing
\begin_inset LatexCommand \index{listing}
\end_inset
for many of the commands.
\begin_inset LatexCommand \index{commands}
\end_inset
\layout Itemize
Chris is also responsible
\begin_inset LatexCommand \index{responsible}
\end_inset
for the great
\begin_inset LatexCommand \index{great}
\end_inset
looking HTML
\begin_inset LatexCommand \index{HTML}
\end_inset
file for this document
\begin_inset LatexCommand \index{document}
\end_inset
(the CSS
\begin_inset LatexCommand \index{CSS}
\end_inset
file and HTML
\begin_inset LatexCommand \index{HTML}
\end_inset
customisations
\begin_inset LatexCommand \index{customisations}
\end_inset
are completely his work).
\layout Itemize
Chris has also helped
\begin_inset LatexCommand \index{helped}
\end_inset
fix up problems
\begin_inset LatexCommand \index{problems}
\end_inset
in the document
\begin_inset LatexCommand \index{document}
\end_inset
(many times), especially
\begin_inset LatexCommand \index{especially}
\end_inset
with docbook/sgml related problems
\begin_inset LatexCommand \index{problems}
\end_inset
and LyX
\begin_inset LatexCommand \index{LyX}
\end_inset
related issues.
\begin_inset LatexCommand \index{issues}
\end_inset
\layout Itemize
Chris has also improved
\begin_inset LatexCommand \index{improved}
\end_inset
the structure
\begin_inset LatexCommand \index{structure}
\end_inset
of the document
\begin_inset LatexCommand \index{document}
\end_inset
by adding
\begin_inset LatexCommand \index{adding}
\end_inset
labels and fixing
\begin_inset LatexCommand \index{fixing}
\end_inset
minor
\begin_inset LatexCommand \index{minor}
\end_inset
errors.
\end_deeper
\layout Description
William\SpecialChar ~
West: William
\begin_inset LatexCommand \index{West, William}
\end_inset
provided a thorough review
\begin_inset LatexCommand \index{review}
\end_inset
of the document
\begin_inset LatexCommand \index{document}
\end_inset
as required
\begin_inset LatexCommand \index{required}
\end_inset
by the
\begin_inset LatexCommand \url[Linux Documentation Project]{https://www.tldp.org}
\end_inset
.
He is responsible
\begin_inset LatexCommand \index{responsible}
\end_inset
for a variety
\begin_inset LatexCommand \index{variety}
\end_inset
of improvements
\begin_inset LatexCommand \index{improvements}
\end_inset
to the quality
\begin_inset LatexCommand \index{quality}
\end_inset
of this document.
\begin_inset LatexCommand \index{document}
\end_inset
\begin_deeper
\layout Standard
His contributions
\begin_inset LatexCommand \index{contributions}
\end_inset
include:
\begin_inset LatexCommand \index{include}
\end_inset
\layout Itemize
Improvements
\begin_inset LatexCommand \index{Improvements}
\end_inset
to the readability
\begin_inset LatexCommand \index{readability}
\end_inset
of this document.
\begin_inset LatexCommand \index{document}
\end_inset
\layout Itemize
Improvements
\begin_inset LatexCommand \index{Improvements}
\end_inset
to the structure
\begin_inset LatexCommand \index{structure}
\end_inset
and consistency
\begin_inset LatexCommand \index{consistency}
\end_inset
of this document.
\begin_inset LatexCommand \index{document}
\end_inset
\layout Itemize
Various grammar
\begin_inset LatexCommand \index{grammar}
\end_inset
improvements throughout the document.
\begin_inset LatexCommand \index{document}
\end_inset
\layout Itemize
Repair
\begin_inset LatexCommand \index{Repair}
\end_inset
of some minor
\begin_inset LatexCommand \index{minor}
\end_inset
technical errors.
\begin_inset LatexCommand \index{errors}
\end_inset
\end_deeper
\layout Description
Tabatha\SpecialChar ~
Persad:
\begin_inset LatexCommand \index{Persad, Tabatha}
\end_inset
Tabatha, as the
\begin_inset LatexCommand \url[Linux Documentation Project]{https://www.tldp.org}
\end_inset
Review
\begin_inset LatexCommand \index{Review}
\end_inset
Coordinator (at the time) also gave
\begin_inset LatexCommand \index{gave}
\end_inset
a brief review
\begin_inset LatexCommand \index{review}
\end_inset
of this document.
\begin_inset LatexCommand \index{document}
\end_inset
Her general
\begin_inset LatexCommand \index{general}
\end_inset
advice was used to improve
\begin_inset LatexCommand \index{improve}
\end_inset
the structure,
\begin_inset LatexCommand \index{structure}
\end_inset
language
\begin_inset LatexCommand \index{language}
\end_inset
and grammar
\begin_inset LatexCommand \index{grammar}
\end_inset
of the document.
\begin_inset LatexCommand \index{document}
\end_inset
\layout Description
Rahul\SpecialChar ~
Sundaram:
\begin_inset LatexCommand \index{Sundaram, Rahul}
\end_inset
Rahul provided
\begin_inset LatexCommand \index{provided}
\end_inset
a brief review
\begin_inset LatexCommand \index{review}
\end_inset
of this document
\begin_inset LatexCommand \index{document}
\end_inset
for the
\begin_inset LatexCommand \url[Linux Documentation Project]{https://www.tldp.org}
\end_inset
.
Advice from his brief review
\begin_inset LatexCommand \index{review}
\end_inset
was integrated
\begin_inset LatexCommand \index{integrated}
\end_inset
into this document
\begin_inset LatexCommand \index{document}
\end_inset
to improve
\begin_inset LatexCommand \index{improve}
\end_inset
readability
\begin_inset LatexCommand \index{readability}
\end_inset
and structure,
\begin_inset LatexCommand \index{structure}
\end_inset
several
\begin_inset LatexCommand \index{several}
\end_inset
references
\begin_inset LatexCommand \index{references}
\end_inset
were added as recommended
\begin_inset LatexCommand \index{recommended}
\end_inset
by Rahual.
\layout Description
David\SpecialChar ~
Lawyer:
\begin_inset LatexCommand \index{Lawyer, David}
\end_inset
David's criticism
\begin_inset LatexCommand \index{criticism}
\end_inset
of the document
\begin_inset LatexCommand \index{document}
\end_inset
(via the TLDP
\begin_inset LatexCommand \index{TLDP}
\end_inset
discuss
\begin_inset LatexCommand \index{discuss}
\end_inset
list) were listened
\begin_inset LatexCommand \index{listened}
\end_inset
to, and attempts
\begin_inset LatexCommand \index{attempts}
\end_inset
to improve
\begin_inset LatexCommand \index{improve}
\end_inset
the document
\begin_inset LatexCommand \index{document}
\end_inset
were made.
A number
\begin_inset LatexCommand \index{number}
\end_inset
of his criticisms
\begin_inset LatexCommand \index{criticisms}
\end_inset
were addressed
\begin_inset LatexCommand \index{addressed}
\end_inset
and improved.
\begin_inset LatexCommand \index{improved}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
I can no longer remember what they were and could not find them in the TLDP
archives.
\end_inset
\layout Description
George\SpecialChar ~
Harmon:
\begin_inset LatexCommand \index{Harmon, George}
\end_inset
George provided
\begin_inset LatexCommand \index{provided}
\end_inset
a second language
\begin_inset LatexCommand \index{language}
\end_inset
review.
\begin_inset LatexCommand \index{review}
\end_inset
His detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
review of the material
\begin_inset LatexCommand \index{material}
\end_inset
allowed
\begin_inset LatexCommand \index{allowed}
\end_inset
me to improve
\begin_inset LatexCommand \index{improve}
\end_inset
the general
\begin_inset LatexCommand \index{general}
\end_inset
grammar
\begin_inset LatexCommand \index{grammar}
\end_inset
of the document
\begin_inset LatexCommand \index{document}
\end_inset
and some minor
\begin_inset LatexCommand \index{minor}
\end_inset
errors.
\layout Description
Machtelt\SpecialChar ~
Garrels\SpecialChar ~
(tille):
\begin_inset LatexCommand \index{Garrels, Machtelt}
\end_inset
Machtelt provided
\begin_inset LatexCommand \index{provided}
\end_inset
tips in regard
\begin_inset LatexCommand \index{regard}
\end_inset
to referencing
\begin_inset LatexCommand \index{referencing}
\end_inset
the correct
\begin_inset LatexCommand \index{correct}
\end_inset
LDP documents
\begin_inset LatexCommand \index{documents}
\end_inset
from this guide.
\begin_inset LatexCommand \index{guide}
\end_inset
As well as general
\begin_inset LatexCommand \index{general}
\end_inset
advice on improvements
\begin_inset LatexCommand \index{improvements}
\end_inset
to the guide.
\begin_inset LatexCommand \index{guide}
\end_inset
\layout Chapter
Legal
\begin_inset LatexCommand \label{Legal}
\end_inset
\layout Standard
The legal
\begin_inset LatexCommand \index{legal}
\end_inset
chapter provides
\begin_inset LatexCommand \index{provides}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
about the disclaimer
\begin_inset LatexCommand \index{disclaimer}
\end_inset
that applies to the entire
\begin_inset LatexCommand \index{entire}
\end_inset
document and the licensing
\begin_inset LatexCommand \index{licensing}
\end_inset
information.
\begin_inset LatexCommand \index{information}
\end_inset
\layout Section
Disclaimer
\begin_inset LatexCommand \label{disclaimer}
\end_inset
\layout Standard
No liability
\begin_inset LatexCommand \index{liability}
\end_inset
for the contents
\begin_inset LatexCommand \index{contents}
\end_inset
of this documents
\begin_inset LatexCommand \index{documents}
\end_inset
can be accepted.
\begin_inset LatexCommand \index{accepted}
\end_inset
Use the concepts,
\begin_inset LatexCommand \index{concepts}
\end_inset
examples
\begin_inset LatexCommand \index{examples}
\end_inset
and other content
\begin_inset LatexCommand \index{content}
\end_inset
at your own risk.
\begin_inset LatexCommand \index{risk}
\end_inset
There may be errors
\begin_inset LatexCommand \index{errors}
\end_inset
and inaccuracies,
\begin_inset LatexCommand \index{inaccuracies}
\end_inset
that may of course be damaging to your system.
\begin_inset LatexCommand \index{system}
\end_inset
Although this is highly
\begin_inset LatexCommand \index{highly}
\end_inset
unlikely,
\begin_inset LatexCommand \index{unlikely}
\end_inset
you should proceed
\begin_inset LatexCommand \index{proceed}
\end_inset
with caution.
\begin_inset LatexCommand \index{caution}
\end_inset
The author
\begin_inset LatexCommand \index{author}
\end_inset
does not accept
\begin_inset LatexCommand \index{accept}
\end_inset
any responsibility
\begin_inset LatexCommand \index{responsibility}
\end_inset
for any damage
\begin_inset LatexCommand \index{damage}
\end_inset
incurred.
\layout Standard
All copyrights
\begin_inset LatexCommand \index{copyrights}
\end_inset
are held by their respective
\begin_inset LatexCommand \index{respective}
\end_inset
owners, unless
\begin_inset LatexCommand \index{unless}
\end_inset
specifically
\begin_inset LatexCommand \index{specifically}
\end_inset
noted otherwise.
Use of a term
\begin_inset LatexCommand \index{term}
\end_inset
in this document
\begin_inset LatexCommand \index{document}
\end_inset
should not be regarded
\begin_inset LatexCommand \index{regarded}
\end_inset
as affecting the validity
\begin_inset LatexCommand \index{validity}
\end_inset
of any trademark
\begin_inset LatexCommand \index{trademark}
\end_inset
or service
\begin_inset LatexCommand \index{service}
\end_inset
mark.
\layout Standard
Naming
\begin_inset LatexCommand \index{Naming}
\end_inset
of particular
\begin_inset LatexCommand \index{particular}
\end_inset
products
\begin_inset LatexCommand \index{products}
\end_inset
or brands
\begin_inset LatexCommand \index{brands}
\end_inset
should not be seen as endorsements.
\begin_inset LatexCommand \index{endorsements}
\end_inset
\layout Standard
UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
is a registered
\begin_inset LatexCommand \index{registered}
\end_inset
trademark
\begin_inset LatexCommand \index{trademark}
\end_inset
of The Open
\begin_inset LatexCommand \index{Open}
\end_inset
Group.
\layout Section
License
\begin_inset LatexCommand \label{license}
\end_inset
\layout Standard
Copyright
\begin_inset LatexCommand \index{Copyright}
\end_inset
© 2003 - 2006 Gareth Anderson.
\begin_inset LatexCommand \index{Anderson}
\end_inset
Permission
\begin_inset LatexCommand \index{Permission}
\end_inset
is granted
\begin_inset LatexCommand \index{granted}
\end_inset
to copy,
\begin_inset LatexCommand \index{copy}
\end_inset
distribute
\begin_inset LatexCommand \index{distribute}
\end_inset
and/or modify
\begin_inset LatexCommand \index{modify}
\end_inset
this document
\begin_inset LatexCommand \index{document}
\end_inset
under the terms
\begin_inset LatexCommand \index{terms}
\end_inset
of the GNU
\begin_inset LatexCommand \index{GNU}
\end_inset
Free
\begin_inset LatexCommand \index{Free}
\end_inset
Documentation License,
\begin_inset LatexCommand \index{License}
\end_inset
\begin_inset LatexCommand \index{GNU Free }
\end_inset
Documentation License} Version
\begin_inset LatexCommand \index{Version}
\end_inset
1.1 or any later version
\begin_inset LatexCommand \index{version}
\end_inset
published by the Free
\begin_inset LatexCommand \index{Free}
\end_inset
Software Foundation;
\begin_inset LatexCommand \index{Foundation}
\end_inset
\begin_inset LatexCommand \index{Free Software }
\end_inset
Foundation} with no Invariant
\begin_inset LatexCommand \index{Invariant}
\end_inset
Sections,
\begin_inset LatexCommand \index{Sections}
\end_inset
with no Front-Cover
\begin_inset LatexCommand \index{Front-Cover}
\end_inset
Texts, and with no Back-Cover
\begin_inset LatexCommand \index{Back-Cover}
\end_inset
Texts.
\begin_inset LatexCommand \index{Texts}
\end_inset
A copy
\begin_inset LatexCommand \index{copy}
\end_inset
of the license
\begin_inset LatexCommand \index{license}
\end_inset
can be found
\begin_inset LatexCommand \index{found}
\end_inset
in the section
\begin_inset LatexCommand \index{section}
\end_inset
called the GNU
\begin_inset LatexCommand \index{GNU}
\end_inset
Free
\begin_inset LatexCommand \index{Free}
\end_inset
Documentation License
\begin_inset LatexCommand \index{License}
\end_inset
or at the
\begin_inset LatexCommand \url[GNU Documentation License Site]{https://www.gnu.org/licenses/licenses.html}
\end_inset
.
\layout Chapter
The Unix Tools Philosophy
\begin_inset LatexCommand \label{The-UNIX-Tools-Philosophy}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
do I need to comply to the open group's rules for use of the UNIX trademark?
-- done now AFAIK renamed a variety of things to UNIX system and stuff,
see above notes for further information...
\end_inset
\layout Standard
A tool
\begin_inset LatexCommand \index{tool}
\end_inset
is a simple program,
\begin_inset LatexCommand \index{program}
\end_inset
usually designed
\begin_inset LatexCommand \index{designed}
\end_inset
for a specific
\begin_inset LatexCommand \index{specific}
\end_inset
purpose, it is sometimes referred
\begin_inset LatexCommand \index{referred}
\end_inset
to (at least
\begin_inset LatexCommand \index{least}
\end_inset
throughout this document) as a command.
\begin_inset LatexCommand \index{command}
\end_inset
\layout Standard
The
\begin_inset Quotes eld
\end_inset
Unix
\begin_inset LatexCommand \index{Unix}
\end_inset
tools
\begin_inset LatexCommand \index{tools}
\end_inset
philosophy
\begin_inset Quotes erd
\end_inset
emerged
\begin_inset LatexCommand \index{emerged}
\end_inset
during the creation
\begin_inset LatexCommand \index{creation}
\end_inset
of the UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
operating system,
\begin_inset LatexCommand \index{system}
\end_inset
after the breakthrough invention
\begin_inset LatexCommand \index{invention}
\end_inset
of the pipe
\begin_inset LatexCommand \index{pipe}
\end_inset
'|' (refer to
\begin_inset LatexCommand \ref{Directing-input-ouput}
\end_inset
for information
\begin_inset LatexCommand \index{information}
\end_inset
on using the pipe).
\layout Standard
The pipe
\begin_inset LatexCommand \index{pipe}
\end_inset
allowed the output
\begin_inset LatexCommand \index{output}
\end_inset
of one program
\begin_inset LatexCommand \index{program}
\end_inset
to be sent to the input
\begin_inset LatexCommand \index{input}
\end_inset
of another.
The tools
\begin_inset LatexCommand \index{tools}
\end_inset
philosophy was to have small
\begin_inset LatexCommand \index{small}
\end_inset
programs
\begin_inset LatexCommand \index{programs}
\end_inset
to accomplish
\begin_inset LatexCommand \index{accomplish}
\end_inset
a particular
\begin_inset LatexCommand \index{particular}
\end_inset
task
\begin_inset LatexCommand \index{task}
\end_inset
instead of trying
\begin_inset LatexCommand \index{trying}
\end_inset
to develop
\begin_inset LatexCommand \index{develop}
\end_inset
large monolithic
\begin_inset LatexCommand \index{monolithic}
\end_inset
programs
\begin_inset LatexCommand \index{programs}
\end_inset
to do a large number
\begin_inset LatexCommand \index{number}
\end_inset
of tasks.
\begin_inset LatexCommand \index{tasks}
\end_inset
To accomplish
\begin_inset LatexCommand \index{accomplish}
\end_inset
more
\begin_inset LatexCommand \index{more}
\end_inset
complex
\begin_inset LatexCommand \index{complex}
\end_inset
tasks,
\begin_inset LatexCommand \index{tasks}
\end_inset
tools
\begin_inset LatexCommand \index{tools}
\end_inset
would simply be connected
\begin_inset LatexCommand \index{connected}
\end_inset
together,
\begin_inset LatexCommand \index{together}
\end_inset
using pipes.
\begin_inset LatexCommand \index{pipes}
\end_inset
\layout Standard
All the core
\begin_inset LatexCommand \index{core}
\end_inset
UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
tools were designed
\begin_inset LatexCommand \index{designed}
\end_inset
so that they could operate
\begin_inset LatexCommand \index{operate}
\end_inset
together.
\begin_inset LatexCommand \index{together}
\end_inset
The original
\begin_inset LatexCommand \index{original}
\end_inset
text-based
\begin_inset LatexCommand \index{text-based}
\end_inset
editors (and even
\begin_inset LatexCommand \index{even}
\end_inset
TeX
\begin_inset LatexCommand \index{TeX}
\end_inset
and LaTeX) use ASCII
\begin_inset LatexCommand \index{ASCII}
\end_inset
(the American
\begin_inset LatexCommand \index{American}
\end_inset
text encoding
\begin_inset LatexCommand \index{encoding}
\end_inset
standard; an open
\begin_inset LatexCommand \index{open}
\end_inset
standard) and you can use tools
\begin_inset LatexCommand \index{tools}
\end_inset
such as;
\emph on
sed
\emph default
,
\emph on
awk
\emph default
,
\emph on
vi
\emph default
,
\emph on
grep
\emph default
,
\emph on
cat
\emph default
,
\emph on
more
\emph default
,
\emph on
tr
\emph default
and various other text-based
\begin_inset LatexCommand \index{text-based}
\end_inset
tools in conjunction
\begin_inset LatexCommand \index{conjunction}
\end_inset
with these editors.
\begin_inset LatexCommand \index{editors}
\end_inset
\begin_inset Note
collapsed true
\layout Standard
tehnically mark up languages (technically!)
\end_inset
\layout Standard
Using this philosophy
\begin_inset LatexCommand \index{philosophy}
\end_inset
programmers
\begin_inset LatexCommand \index{programmers}
\end_inset
avoided writing
\begin_inset LatexCommand \index{writing}
\end_inset
a program
\begin_inset LatexCommand \index{program}
\end_inset
(within their larger program) that had already been written
\begin_inset LatexCommand \index{written}
\end_inset
by someone else (this is sometimes called code
\begin_inset LatexCommand \index{code}
\end_inset
recycling).
For example,
\begin_inset LatexCommand \index{example}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
line spell
\begin_inset LatexCommand \index{spell}
\end_inset
checkers are used by a number
\begin_inset LatexCommand \index{number}
\end_inset
of different
\begin_inset LatexCommand \index{different}
\end_inset
applications
\begin_inset LatexCommand \index{applications}
\end_inset
instead of having each application
\begin_inset LatexCommand \index{application}
\end_inset
create its own own spell
\begin_inset LatexCommand \index{spell}
\end_inset
checker.
\begin_inset LatexCommand \index{checker}
\end_inset
\layout Standard
This philosophy
\begin_inset LatexCommand \index{philosophy}
\end_inset
lives on today
\begin_inset LatexCommand \index{today}
\end_inset
in GNU/Linux and various other UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system-based operating
\begin_inset LatexCommand \index{operating}
\end_inset
systems
\begin_inset LatexCommand \index{systems}
\end_inset
(FreeBSD, NetBSD,
\begin_inset LatexCommand \index{NetBSD}
\end_inset
OpenBSD,
\begin_inset LatexCommand \index{OpenBSD}
\end_inset
etc.).
\layout Standard
For further information
\begin_inset LatexCommand \index{information}
\end_inset
(articles) on the UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
tools philosophy
\begin_inset LatexCommand \index{philosophy}
\end_inset
please see the further reading
\begin_inset LatexCommand \index{reading}
\end_inset
section,
\begin_inset LatexCommand \index{section}
\end_inset
here:
\begin_inset LatexCommand \ref{unix-tools-further-reading}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
well I hope that's correct.
My knowledge of UNIX history is not 100% perfect.
Should I mention that code evolves as part of the UNIX philosophy? it's
sort of connected\SpecialChar \ldots{}
\end_inset
\layout Chapter
Shell Tips
\begin_inset LatexCommand \label{Shell-Tips}
\end_inset
\layout Standard
The shell
\begin_inset LatexCommand \index{shell}
\end_inset
tips chapter provides
\begin_inset LatexCommand \index{provides}
\end_inset
handy tricks
\begin_inset LatexCommand \index{tricks}
\end_inset
that you may wish to use when you are using a GNU/Linux shell
\begin_inset LatexCommand \index{shell}
\end_inset
(the command
\begin_inset LatexCommand \index{command}
\end_inset
line interface).
This information
\begin_inset LatexCommand \index{information}
\end_inset
includes handy
\begin_inset LatexCommand \index{handy}
\end_inset
shortcut
\begin_inset LatexCommand \index{shortcut}
\end_inset
key combinations,
\begin_inset LatexCommand \index{combinations}
\end_inset
the shell's command
\begin_inset LatexCommand \index{command}
\end_inset
history and information
\begin_inset LatexCommand \index{information}
\end_inset
on virtual
\begin_inset LatexCommand \index{virtual}
\end_inset
terminals.
\layout SGML
\layout SGML
If you can't boot into your system
\layout SGML
If your having problems booting into your system you may like to use
a shell so you can boot into your system and attempt to fix things up again.
\layout SGML
To do this you need to pass the
\begin_inset Quotes eld
\end_inset
init=/bin/sh
\begin_inset Quotes erd
\end_inset
to your system before you boot up.
\layout SGML
If you don't know how to do this please see
\begin_inset LatexCommand \ref{Security}
\end_inset
, the technique is the same except this time you pass "init=bin/sh" rather
than "single".
\layout SGML
\layout Section
General Shell Tips
\begin_inset LatexCommand \label{general-Shell-Tips}
\end_inset
\layout Description
Automatic\SpecialChar ~
Command\SpecialChar ~
Completion
\begin_inset LatexCommand \index{Completion}
\end_inset
Use the TAB
\begin_inset LatexCommand \index{TAB}
\end_inset
key and BASH
\begin_inset LatexCommand \index{BASH}
\end_inset
will attempt
\begin_inset LatexCommand \index{attempt}
\end_inset
to complete
\begin_inset LatexCommand \index{complete}
\end_inset
the command
\begin_inset LatexCommand \index{command}
\end_inset
for you automatically.
\begin_inset LatexCommand \index{automatically}
\end_inset
You can use it to complete
\begin_inset LatexCommand \index{complete}
\end_inset
command (tool) names.
You can also use it when working
\begin_inset LatexCommand \index{working}
\end_inset
with the file-system,
\begin_inset LatexCommand \index{file-system}
\end_inset
when changing directories, copying
\begin_inset LatexCommand \index{copying}
\end_inset
files et cetera.
\begin_inset LatexCommand \index{cetera}
\end_inset
\begin_deeper
\layout Standard
There are also other lesser
\begin_inset LatexCommand \index{lesser}
\end_inset
known ways to use automatic
\begin_inset LatexCommand \index{automatic}
\end_inset
command completion
\begin_inset LatexCommand \index{completion}
\end_inset
(for example
\begin_inset LatexCommand \index{example}
\end_inset
completing
\begin_inset LatexCommand \index{completing}
\end_inset
user
\begin_inset LatexCommand \index{user}
\end_inset
names):
\begin_inset Foot
collapsed true
\layout Standard
This information was adopted (with editing) from Mandrakesoft's Command
Line Manual, see [7] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
\layout Description
ESC-Y\SpecialChar ~
(Y:\SpecialChar ~
special\SpecialChar ~
character) Will attempt
\begin_inset LatexCommand \index{attempt}
\end_inset
to complete
\begin_inset LatexCommand \index{complete}
\end_inset
the command
\begin_inset LatexCommand \index{command}
\end_inset
name for you.
If it fails
\begin_inset LatexCommand \index{fails}
\end_inset
it will either list
\begin_inset LatexCommand \index{list}
\end_inset
the possible
\begin_inset LatexCommand \index{possible}
\end_inset
completions
\begin_inset LatexCommand \index{completions}
\end_inset
(if they exist).
If there are none
\begin_inset LatexCommand \index{none}
\end_inset
it will simply beep
\begin_inset LatexCommand \index{beep}
\end_inset
(and/or) flash
\begin_inset LatexCommand \index{flash}
\end_inset
the screen.
\begin_inset LatexCommand \index{screen}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
redundant? Note that you must hold escape and press the special character
(see below) for this to work.
\end_inset
\layout Description
CTRL-X-Y\SpecialChar ~
(Y:\SpecialChar ~
special\SpecialChar ~
character) Lists
\begin_inset LatexCommand \index{Lists}
\end_inset
the possible
\begin_inset LatexCommand \index{possible}
\end_inset
completions
\begin_inset LatexCommand \index{completions}
\end_inset
(it won't attempt
\begin_inset LatexCommand \index{attempt}
\end_inset
to complete
\begin_inset LatexCommand \index{complete}
\end_inset
it for you) or beep
\begin_inset LatexCommand \index{beep}
\end_inset
if there are no possible
\begin_inset LatexCommand \index{possible}
\end_inset
completions.
\begin_inset LatexCommand \index{completions}
\end_inset
\layout Standard
\series bold
Special-characters:
\layout Standard
Use the following
\begin_inset LatexCommand \index{following}
\end_inset
special
\begin_inset LatexCommand \index{special}
\end_inset
characters combined
\begin_inset LatexCommand \index{combined}
\end_inset
with either ESC-Y or CTRL-X-Y, where Y is some special
\begin_inset LatexCommand \index{special}
\end_inset
character.
\begin_inset LatexCommand \index{character}
\end_inset
For example
\begin_inset LatexCommand \index{example}
\end_inset
ESC-$ or CTRL-X-$ to complete
\begin_inset LatexCommand \index{complete}
\end_inset
an environment
\begin_inset LatexCommand \index{environment}
\end_inset
variable name.
\layout Itemize
\series bold
~
\series default
(tilde)
\begin_inset LatexCommand \index{tilde}
\end_inset
\begin_inset LatexCommand \index{~}
\end_inset
complete
\begin_inset LatexCommand \index{complete}
\end_inset
a user
\begin_inset LatexCommand \index{user}
\end_inset
name
\layout Itemize
@ (at sign)
\begin_inset LatexCommand \index{at, sign}
\end_inset
\begin_inset LatexCommand \index{@}
\end_inset
complete
\begin_inset LatexCommand \index{complete}
\end_inset
a machine
\begin_inset LatexCommand \index{machine}
\end_inset
name
\layout Itemize
$ (dollars sign)
\begin_inset LatexCommand \index{dollar sign}
\end_inset
\begin_inset LatexCommand \index{$}
\end_inset
complete
\begin_inset LatexCommand \index{complete}
\end_inset
an environment
\begin_inset LatexCommand \index{environment}
\end_inset
variable name
\layout Itemize
! (exclamation mark)
\begin_inset LatexCommand \index{exclamation mark}
\end_inset
\begin_inset LatexCommand \index{!}
\end_inset
a magic
\begin_inset LatexCommand \index{magic}
\end_inset
character
\begin_inset LatexCommand \index{character}
\end_inset
for completing
\begin_inset LatexCommand \index{completing}
\end_inset
a command
\begin_inset LatexCommand \index{command}
\end_inset
name or a file
\begin_inset LatexCommand \index{file}
\end_inset
name (/).
The ! special
\begin_inset LatexCommand \index{special}
\end_inset
character
\begin_inset LatexCommand \index{character}
\end_inset
has the same function
\begin_inset LatexCommand \index{function}
\end_inset
as the TAB
\begin_inset LatexCommand \index{TAB}
\end_inset
key.
It works
\begin_inset LatexCommand \index{works}
\end_inset
in some other situations; for example
\begin_inset LatexCommand \index{example}
\end_inset
when completing
\begin_inset LatexCommand \index{completing}
\end_inset
man page
\begin_inset LatexCommand \index{page}
\end_inset
names.
\end_deeper
\layout Description
alias
\begin_inset LatexCommand \index{alias}
\end_inset
The
\emph on
alias
\emph default
command
\begin_inset LatexCommand \index{command}
\end_inset
will list
\begin_inset LatexCommand \index{list}
\end_inset
your current
\begin_inset LatexCommand \index{current}
\end_inset
aliases.
\begin_inset LatexCommand \index{aliases}
\end_inset
You can use
\emph on
unalias
\emph default
to remove
\begin_inset LatexCommand \index{remove}
\end_inset
the alias
\begin_inset LatexCommand \index{alias}
\end_inset
(to disable
\begin_inset LatexCommand \index{disable}
\end_inset
it just for one command
\begin_inset LatexCommand \index{command}
\end_inset
add a
\begin_inset Quotes eld
\end_inset
\backslash
\begin_inset Quotes erd
\end_inset
(back-slash) before the command)\SpecialChar \ldots{}
\begin_deeper
\layout Standard
An alias
\begin_inset LatexCommand \index{alias}
\end_inset
allows
\begin_inset LatexCommand \index{allows}
\end_inset
one command
\begin_inset LatexCommand \index{command}
\end_inset
to be substituted
\begin_inset LatexCommand \index{substituted}
\end_inset
for another.
This is used to make a command
\begin_inset LatexCommand \index{command}
\end_inset
do something else or to automatically
\begin_inset LatexCommand \index{automatically}
\end_inset
add
\begin_inset LatexCommand \index{add}
\end_inset
certain options.
\begin_inset LatexCommand \index{options}
\end_inset
This can be either be done during one session
\begin_inset LatexCommand \index{session}
\end_inset
using the alias
\begin_inset LatexCommand \index{alias}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
(see below) or the information
\begin_inset LatexCommand \index{information}
\end_inset
can be added to the
\emph on
.bashrc
\emph default
file
\begin_inset LatexCommand \index{file}
\end_inset
(found in the users
\begin_inset LatexCommand \index{users}
\end_inset
home
\begin_inset LatexCommand \index{home}
\end_inset
directory).
\layout Standard
Below is an example
\begin_inset LatexCommand \index{example}
\end_inset
of what an alias
\begin_inset LatexCommand \index{alias}
\end_inset
section
\begin_inset LatexCommand \index{section}
\end_inset
(within your
\emph on
.bashrc
\emph default
file) might look
\begin_inset LatexCommand \index{look}
\end_inset
like:
\layout Code
\noindent
# my personal aliases
\layout Code
\noindent
alias cp='cp -vi' #to prompt when copying if you want to overwrite and will
tell you where information is going
\layout Code
\noindent
alias rm='rm -i' #Prompts you if you really want to remove it.
\layout Code
\noindent
alias mv='mv -i' #Prompts you if you are going to overwrite something
\layout Standard
On any Mandrake/Mandriva Linux
\begin_inset LatexCommand \index{Linux}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
the global
\begin_inset LatexCommand \index{global}
\end_inset
aliases
\begin_inset LatexCommand \index{aliases}
\end_inset
(for all users) are all in /etc/profile.d/alias.sh.
The above listed
\begin_inset LatexCommand \index{listed}
\end_inset
commands already have aliases,
\begin_inset LatexCommand \index{aliases}
\end_inset
as well as several
\begin_inset LatexCommand \index{several}
\end_inset
other commonly
\begin_inset LatexCommand \index{commonly}
\end_inset
used commands.
\begin_inset LatexCommand \index{commands}
\end_inset
\end_deeper
\layout Description
set\SpecialChar ~
-x
\begin_inset LatexCommand \index{-x}
\end_inset
\emph on
set
\begin_inset LatexCommand \index{set}
\end_inset
\emph default
is one of bash's inbuilt
\begin_inset LatexCommand \index{inbuilt}
\end_inset
commands,
\begin_inset LatexCommand \index{commands}
\end_inset
try
\begin_inset LatexCommand \index{try}
\end_inset
looking in the bash
\begin_inset LatexCommand \index{bash}
\end_inset
manual for its many usage
\begin_inset LatexCommand \index{usage}
\end_inset
options.
\begin_inset LatexCommand \index{options}
\end_inset
\begin_deeper
\layout Standard
Using
\emph on
set
\emph default
with the
\emph on
-x
\begin_inset LatexCommand \index{-x}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
will make bash
\begin_inset LatexCommand \index{bash}
\end_inset
print out each command
\begin_inset LatexCommand \index{command}
\end_inset
it is going to run
\begin_inset LatexCommand \index{run}
\end_inset
before it runs
\begin_inset LatexCommand \index{runs}
\end_inset
it.
\layout Standard
This can be useful to find
\begin_inset LatexCommand \index{find}
\end_inset
out what is happening with certain commands
\begin_inset LatexCommand \index{commands}
\end_inset
such as things being quoted
\begin_inset LatexCommand \index{quoted}
\end_inset
that contain wildcards
\begin_inset LatexCommand \index{wildcards}
\end_inset
or special
\begin_inset LatexCommand \index{special}
\end_inset
symbols
\begin_inset LatexCommand \index{symbols}
\end_inset
that could cause
\begin_inset LatexCommand \index{cause}
\end_inset
problems, or complex
\begin_inset LatexCommand \index{complex}
\end_inset
aliases.
\begin_inset LatexCommand \index{aliases}
\end_inset
Use
\emph on
set
\begin_inset LatexCommand \index{set}
\end_inset
+x
\emph default
to turn
\begin_inset LatexCommand \index{turn}
\end_inset
this back off.
\begin_inset LatexCommand \index{off}
\end_inset
\layout Standard
Examples
\layout Standard
After using
\emph on
set
\begin_inset LatexCommand \index{set}
\end_inset
-x
\emph default
you can run
\begin_inset LatexCommand \index{run}
\end_inset
the command:
\begin_inset LatexCommand \index{command}
\end_inset
\layout Code
ls
\layout Standard
The output
\begin_inset LatexCommand \index{output}
\end_inset
printed
\begin_inset LatexCommand \index{printed}
\end_inset
before the command
\begin_inset LatexCommand \index{command}
\end_inset
runs (for example):
\layout Code
+ ls -F --color=auto
\layout Standard
Which means that the command
\begin_inset LatexCommand \index{command}
\end_inset
is really
\begin_inset LatexCommand \index{really}
\end_inset
an alias
\begin_inset LatexCommand \index{alias}
\end_inset
to run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
ls
\emph default
with the
\emph on
-F
\emph default
and
\emph on
--color=auto
\emph default
options.
\begin_inset LatexCommand \index{options}
\end_inset
Use a
\begin_inset Quotes eld
\end_inset
\backslash
\begin_inset Quotes erd
\end_inset
(backslash) before the command
\begin_inset LatexCommand \index{command}
\end_inset
to run
\begin_inset LatexCommand \index{run}
\end_inset
it without the alias.
\begin_inset LatexCommand \index{alias}
\end_inset
\end_deeper
\layout Description
\noindent
\backslash
\SpecialChar ~
(backslash)
\begin_inset LatexCommand \index{\}
\end_inset
The backslash
\begin_inset LatexCommand \index{backslash}
\end_inset
escape character
\begin_inset LatexCommand \index{character}
\end_inset
can be used before a shell
\begin_inset LatexCommand \index{shell}
\end_inset
command to override
\begin_inset LatexCommand \index{override}
\end_inset
any aliases.
\begin_inset LatexCommand \index{aliases}
\end_inset
\begin_deeper
\layout Standard
For example
\begin_inset LatexCommand \index{example}
\end_inset
if
\emph on
rm
\emph default
was made into an alias
\begin_inset LatexCommand \index{alias}
\end_inset
for
\emph on
rm
\begin_inset LatexCommand \index{rm}
\end_inset
-i
\begin_inset LatexCommand \index{-i}
\end_inset
\emph default
then typing
\begin_inset Quotes eld
\end_inset
rm
\begin_inset Quotes erd
\end_inset
would actually run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
rm
\begin_inset LatexCommand \index{rm}
\end_inset
-i
\begin_inset LatexCommand \index{-i}
\end_inset
\emph default
.
\layout Standard
However, typing
\emph on
\backslash
rm
\emph default
lets the shell
\begin_inset LatexCommand \index{shell}
\end_inset
ignore the alias
\begin_inset LatexCommand \index{alias}
\end_inset
and just run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
rm
\emph default
(its runs
\begin_inset LatexCommand \index{runs}
\end_inset
exactly what you type), this way it won't confirm
\begin_inset LatexCommand \index{confirm}
\end_inset
if you want to delete
\begin_inset LatexCommand \index{delete}
\end_inset
things.
\layout SGML
\layout SGML
Using rm
\layout SGML
Please note that the alias for the remove command is there for a reason.
Using it incorrectly could remove files which you don't want removed.
\layout SGML
Only use
\emph on
\backslash
rm
\emph default
if you know exactly what you are doing (recovering files is not easy,
\emph on
rm
\emph default
does not send things to a recycle bin).
\layout SGML
\layout Standard
\noindent
The
\begin_inset Quotes eld
\end_inset
\backslash
\begin_inset Quotes erd
\end_inset
character
\begin_inset LatexCommand \index{character}
\end_inset
can be used before special
\begin_inset LatexCommand \index{special}
\end_inset
characters (such as a space
\begin_inset LatexCommand \index{space}
\end_inset
or a wildcard.
\begin_inset LatexCommand \index{wildcard}
\end_inset
..) to stop
\begin_inset LatexCommand \index{stop}
\end_inset
bash
\begin_inset LatexCommand \index{bash}
\end_inset
from trying
\begin_inset LatexCommand \index{trying}
\end_inset
to expand
\begin_inset LatexCommand \index{expand}
\end_inset
them (a directory
\begin_inset LatexCommand \index{directory}
\end_inset
name with a space
\begin_inset LatexCommand \index{space}
\end_inset
in it is possible
\begin_inset LatexCommand \index{possible}
\end_inset
this way).
For example
\begin_inset LatexCommand \index{example}
\end_inset
you could type
\emph on
cd
\emph default
\emph on
My
\emph default
\backslash
\emph on
Directory
\begin_inset LatexCommand \index{Directory}
\end_inset
\emph default
\backslash
\emph on
With
\emph default
\backslash
\emph on
Spaces
\begin_inset LatexCommand \index{Spaces}
\end_inset
\emph default
which
\begin_inset LatexCommand \index{which}
\end_inset
normally wouldn't work.
\begin_inset LatexCommand \index{work}
\end_inset
\layout Standard
The
\begin_inset Quotes eld
\end_inset
\backslash
\begin_inset Quotes erd
\end_inset
character
\begin_inset LatexCommand \index{character}
\end_inset
can also be used to stop
\begin_inset LatexCommand \index{stop}
\end_inset
bash
\begin_inset LatexCommand \index{bash}
\end_inset
from expanding
\begin_inset LatexCommand \index{expanding}
\end_inset
certain symbols
\begin_inset LatexCommand \index{symbols}
\end_inset
(as an alternative
\begin_inset LatexCommand \index{alternative}
\end_inset
you could use single quotation
\begin_inset LatexCommand \index{quotation}
\end_inset
marks, although you may need to use both).
\layout SGML
\layout SGML
The TAB Key
\layout SGML
Please note that using the TAB key (automatic-command-completion)
will automatically use escapes for spaces (so you don't have to type them
manually).
\layout SGML
\end_deeper
\layout Description
script
\begin_inset LatexCommand \index{script}
\end_inset
The
\begin_inset Quotes eld
\end_inset
\emph on
script
\emph default
\begin_inset Quotes erd
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
creates a typescript,
\begin_inset LatexCommand \index{typescript}
\end_inset
or "capture log" of a shell
\begin_inset LatexCommand \index{shell}
\end_inset
session - it writes
\begin_inset LatexCommand \index{writes}
\end_inset
a copy
\begin_inset LatexCommand \index{copy}
\end_inset
of your session
\begin_inset LatexCommand \index{session}
\end_inset
to a file,
\begin_inset LatexCommand \index{file}
\end_inset
including
\begin_inset LatexCommand \index{including}
\end_inset
commands
\begin_inset LatexCommand \index{commands}
\end_inset
you type and their output.
\begin_inset LatexCommand \index{output}
\end_inset
\layout Description
\noindent
~\SpecialChar ~
(tilde\SpecialChar ~
character)
\begin_inset LatexCommand \index{~}
\end_inset
The tilde
\begin_inset LatexCommand \index{tilde}
\end_inset
character
\begin_inset LatexCommand \index{character}
\end_inset
is used as an alias
\begin_inset LatexCommand \index{alias}
\end_inset
to a users
\begin_inset LatexCommand \index{users}
\end_inset
home
\begin_inset LatexCommand \index{home}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
\begin_deeper
\layout Standard
\noindent
For example,
\begin_inset LatexCommand \index{example}
\end_inset
if your user-name
\begin_inset LatexCommand \index{user-name}
\end_inset
was
\begin_inset Quotes eld
\end_inset
fred
\begin_inset Quotes erd
\end_inset
, instead of typing
\emph on
cd
\begin_inset LatexCommand \index{cd}
\end_inset
/home/fred
\emph default
you could simply type
\emph on
cd
\begin_inset LatexCommand \index{cd}
\end_inset
~.
\emph default
Or to get to fred's tmp
\begin_inset LatexCommand \index{tmp}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
(under his home
\begin_inset LatexCommand \index{home}
\end_inset
directory) you could type
\emph on
cd
\begin_inset LatexCommand \index{cd}
\end_inset
~/tmp.
\layout SGML
\layout SGML
Home directory shortcut
\layout SGML
~ (tilde) can also be used as a shortcut to other users home directories,
simply type:
\emph on
~user_name
\emph default
and it will take you to the user's home directory.
Note that you need to spell the username exactly correct, no wildcards.
\layout SGML
\end_deeper
\layout Description
\begin_inset Note
collapsed false
\layout Standard
useful but for X only\SpecialChar \ldots{}
xset\SpecialChar ~
-b turns off x system bell.
\end_inset
\layout Description
set\SpecialChar ~
bell-style\SpecialChar ~
none
\begin_inset LatexCommand \index{set bell style}
\end_inset
This particular
\begin_inset LatexCommand \index{particular}
\end_inset
\emph on
set
\emph default
command
\begin_inset LatexCommand \index{command}
\end_inset
will turn
\begin_inset LatexCommand \index{turn}
\end_inset
off
\begin_inset LatexCommand \index{off}
\end_inset
the system
\begin_inset LatexCommand \index{system}
\end_inset
bell from the commandline
\begin_inset LatexCommand \index{commandline}
\end_inset
(use xset
\begin_inset LatexCommand \index{xset}
\end_inset
-b for X windows).
If you want the bell
\begin_inset LatexCommand \index{bell}
\end_inset
to stay off
\begin_inset LatexCommand \index{off}
\end_inset
pernamently (no audible
\begin_inset LatexCommand \index{audible}
\end_inset
bell) then you can add
\begin_inset LatexCommand \index{add}
\end_inset
this command
\begin_inset LatexCommand \index{command}
\end_inset
to your
\begin_inset Quotes eld
\end_inset
.bashrc
\begin_inset Quotes erd
\end_inset
or
\begin_inset Quotes eld
\end_inset
.bash_profile
\begin_inset Quotes erd
\end_inset
(just add it to the same one you have your alises in\SpecialChar \ldots{}
).
\layout Description
reset
\begin_inset LatexCommand \index{reset}
\end_inset
The
\emph on
reset
\emph default
command
\begin_inset LatexCommand \index{command}
\end_inset
re-initializes your current
\begin_inset LatexCommand \index{current}
\end_inset
terminal.
\begin_inset LatexCommand \index{terminal}
\end_inset
This can be useful when the text
\begin_inset LatexCommand \index{text}
\end_inset
from your terminal's text
\begin_inset LatexCommand \index{text}
\end_inset
becomes garbled,
\begin_inset LatexCommand \index{garbled}
\end_inset
simply type
\begin_inset Quotes eld
\end_inset
reset
\begin_inset Quotes erd
\end_inset
and this will fix
\begin_inset LatexCommand \index{fix}
\end_inset
your terminal.
\begin_inset LatexCommand \index{terminal}
\end_inset
\layout Description
exit
\begin_inset LatexCommand \index{exit}
\end_inset
Closes your current
\begin_inset LatexCommand \index{current}
\end_inset
terminal
\begin_inset LatexCommand \index{terminal}
\end_inset
(with x-terminals) or logs-out.
\begin_inset LatexCommand \index{logs-out}
\end_inset
Also try
\begin_inset LatexCommand \index{try}
\end_inset
CTRL-D.
\layout Description
\noindent
logout
\begin_inset LatexCommand \index{logout}
\end_inset
Logs out of a terminal,
\begin_inset LatexCommand \index{terminal}
\end_inset
also try
\begin_inset LatexCommand \index{try}
\end_inset
CTRL-D.
\layout Description
\noindent
echo
\begin_inset LatexCommand \index{echo}
\end_inset
A little command
\begin_inset LatexCommand \index{command}
\end_inset
that repeats
\begin_inset LatexCommand \index{repeats}
\end_inset
anything you type.
\begin_deeper
\layout Standard
\noindent
Example:
\layout Code
\noindent
echo
\begin_inset Quotes eld
\end_inset
hello world
\begin_inset Quotes erd
\end_inset
\layout Standard
\noindent
Simply displays
\begin_inset Quotes eld
\end_inset
hello
\begin_inset LatexCommand \index{hello}
\end_inset
world
\begin_inset LatexCommand \index{world}
\end_inset
\begin_inset Quotes erd
\end_inset
.
\layout Standard
\noindent
Example:
\layout Code
echo rm -R *
\layout Standard
This will output
\begin_inset LatexCommand \index{output}
\end_inset
what will be passed
\begin_inset LatexCommand \index{passed}
\end_inset
to the
\emph on
rm
\emph default
command
\begin_inset LatexCommand \index{command}
\end_inset
(and therefore what would be deleted), putting
\begin_inset LatexCommand \index{putting}
\end_inset
echo before a command renders
\begin_inset LatexCommand \index{renders}
\end_inset
it harmless
\begin_inset LatexCommand \index{harmless}
\end_inset
(it just expands
\begin_inset LatexCommand \index{expands}
\end_inset
wildcards
\begin_inset LatexCommand \index{wildcards}
\end_inset
so you know what it will do).
\layout Standard
Also try
\begin_inset LatexCommand \index{try}
\end_inset
using the
\emph on
-e
\begin_inset LatexCommand \index{-e}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
with echo.
\begin_inset LatexCommand \index{echo}
\end_inset
This will allow
\begin_inset LatexCommand \index{allow}
\end_inset
you to use the escape
\begin_inset LatexCommand \index{escape}
\end_inset
character
\begin_inset LatexCommand \index{character}
\end_inset
sequences to format
\begin_inset LatexCommand \index{format}
\end_inset
the output
\begin_inset LatexCommand \index{output}
\end_inset
of a line.
\begin_inset LatexCommand \index{line}
\end_inset
Such as '
\backslash
t' for tab,
\begin_inset LatexCommand \index{tab}
\end_inset
'
\backslash
n' for newline
\begin_inset LatexCommand \index{newline}
\end_inset
etc.
\layout SGML
\layout SGML
Using echo to prevent accidents
\layout SGML
\layout SGML
Typing:
\emph on
echo command(s)
\emph default
could
\emph on
\emph default
save you the trouble of accidentally doing something you didn't expect.
\layout SGML
\layout SGML
\layout SGML
Using
\emph on
echo
\emph default
allows you to expand the wildcards to understand what will happen before
you actually run the command.
\layout SGML
\layout SGML
\end_deeper
\layout Section
The command-line history
\begin_inset LatexCommand \label{the-command-line-history}
\end_inset
\layout Description
Using\SpecialChar ~
the\SpecialChar ~
command\SpecialChar ~
history
\begin_inset LatexCommand \index{history}
\end_inset
Use the up and down key's to scroll
\begin_inset LatexCommand \index{scroll}
\end_inset
through previously typed commands.
\begin_inset LatexCommand \index{commands}
\end_inset
Press
\begin_inset LatexCommand \index{Press}
\end_inset
[Enter] to execute
\begin_inset LatexCommand \index{execute}
\end_inset
them or use the left
\begin_inset LatexCommand \index{left}
\end_inset
and right arrow
\begin_inset LatexCommand \index{arrow}
\end_inset
keys to edit
\begin_inset LatexCommand \index{edit}
\end_inset
the command
\begin_inset LatexCommand \index{command}
\end_inset
first.
Also see
\emph on
history
\emph default
(below).
\layout Description
\noindent
The\SpecialChar ~
history\SpecialChar ~
command
\begin_inset LatexCommand \index{command}
\end_inset
The
\emph on
history
\begin_inset LatexCommand \index{history}
\end_inset
\emph default
command
\begin_inset LatexCommand \index{command}
\end_inset
can be used to list
\begin_inset LatexCommand \index{list}
\end_inset
Bash's log
\begin_inset LatexCommand \index{log}
\end_inset
of the commands
\begin_inset LatexCommand \index{commands}
\end_inset
you have typed:
\begin_deeper
\layout Standard
This log
\begin_inset LatexCommand \index{log}
\end_inset
is called the
\begin_inset Quotes eld
\end_inset
history
\begin_inset Quotes erd
\end_inset
.
To access
\begin_inset LatexCommand \index{access}
\end_inset
it type:
\layout Code
\noindent
history n
\layout Standard
\noindent
This will only list
\begin_inset LatexCommand \index{list}
\end_inset
the last
\begin_inset LatexCommand \index{last}
\end_inset
\emph on
n
\emph default
commands.
\begin_inset LatexCommand \index{commands}
\end_inset
Type
\begin_inset Quotes eld
\end_inset
history
\begin_inset Quotes erd
\end_inset
(without options) to see the the entire
\begin_inset LatexCommand \index{entire}
\end_inset
history list.
\begin_inset LatexCommand \index{list}
\end_inset
\layout Standard
\noindent
You can also type
\emph on
!n
\emph default
to execute
\begin_inset LatexCommand \index{execute}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
number n.
Use
\emph on
!!
\emph default
to execute
\begin_inset LatexCommand \index{execute}
\end_inset
the last
\begin_inset LatexCommand \index{last}
\end_inset
command you typed.
\layout Standard
\noindent
\emph on
!-n
\emph default
will execute
\begin_inset LatexCommand \index{execute}
\end_inset
the command
\begin_inset LatexCommand \index{command}
\end_inset
n times
\begin_inset LatexCommand \index{times}
\end_inset
before (ie.
\emph on
!-1
\emph default
is equivalent
\begin_inset LatexCommand \index{equivalent}
\end_inset
to
\emph on
!!
\emph default
).
\layout Standard
\noindent
\emph on
!string
\emph default
will execute
\begin_inset LatexCommand \index{execute}
\end_inset
the last
\begin_inset LatexCommand \index{last}
\end_inset
command starting
\begin_inset LatexCommand \index{starting}
\end_inset
with that
\begin_inset Quotes eld
\end_inset
string
\begin_inset Quotes erd
\end_inset
and
\emph on
!?string?
\emph default
will execute
\begin_inset LatexCommand \index{execute}
\end_inset
the last
\begin_inset LatexCommand \index{last}
\end_inset
command containing the word
\begin_inset LatexCommand \index{word}
\end_inset
\begin_inset Quotes eld
\end_inset
string
\begin_inset Quotes erd
\end_inset
.
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
!cd
\layout Standard
Will re-run the command
\begin_inset LatexCommand \index{command}
\end_inset
that you last
\begin_inset LatexCommand \index{last}
\end_inset
typed starting
\begin_inset LatexCommand \index{starting}
\end_inset
with
\begin_inset Quotes eld
\end_inset
cd
\begin_inset Quotes erd
\end_inset
.
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
the idea of the below command came from https://www.linux-mag.com/2004-05/power_01.h
tml but I used my own examples and ideas here.
Add them to references eventually\SpecialChar \ldots{}
\end_inset
\layout Standard
\emph on
\begin_inset Quotes eld
\end_inset
commandName
\begin_inset LatexCommand \index{commandName}
\end_inset
!*
\begin_inset Quotes erd
\end_inset
\emph default
will execute
\begin_inset LatexCommand \index{execute}
\end_inset
the
\begin_inset Quotes eld
\end_inset
commandName
\begin_inset Quotes erd
\end_inset
with any arguments
\begin_inset LatexCommand \index{arguments}
\end_inset
you used on your last
\begin_inset LatexCommand \index{last}
\end_inset
command.
This maybe useful if you make a spelling
\begin_inset LatexCommand \index{spelling}
\end_inset
mistake, for example.
\begin_inset LatexCommand \index{example}
\end_inset
If you typed:
\layout Code
emasc /home/fred/mywork.java /tmp/testme.java
\layout Standard
In an attempt
\begin_inset LatexCommand \index{attempt}
\end_inset
to execute
\begin_inset LatexCommand \index{execute}
\end_inset
emacs
\begin_inset LatexCommand \index{emacs}
\end_inset
on the above two files
\begin_inset LatexCommand \index{files}
\end_inset
this will obviously fail.
\begin_inset LatexCommand \index{fail}
\end_inset
So what you can do is type:
\layout Code
emacs !*
\layout Standard
This will execute
\begin_inset LatexCommand \index{execute}
\end_inset
emacs
\begin_inset LatexCommand \index{emacs}
\end_inset
with the arguments
\begin_inset LatexCommand \index{arguments}
\end_inset
that you last
\begin_inset LatexCommand \index{last}
\end_inset
typed on the command
\begin_inset LatexCommand \index{command}
\end_inset
line.
\begin_inset LatexCommand \index{line}
\end_inset
In other words
\begin_inset LatexCommand \index{words}
\end_inset
this is equivalent
\begin_inset LatexCommand \index{equivalent}
\end_inset
to typing:
\layout Code
emacs /home/fred/mywork.java /tmp/testme.java
\end_deeper
\layout Description
Searching\SpecialChar ~
through\SpecialChar ~
the\SpecialChar ~
Command\SpecialChar ~
History\SpecialChar ~
(CTRL-R) Use the CTRL-R key
\begin_inset LatexCommand \index{key}
\end_inset
to perform
\begin_inset LatexCommand \index{perform}
\end_inset
a
\begin_inset Quotes eld
\end_inset
reverse-i-search
\begin_inset Quotes erd
\end_inset
.
For example,
\begin_inset LatexCommand \index{example}
\end_inset
if you wanted to use the command
\begin_inset LatexCommand \index{command}
\end_inset
you used the last
\begin_inset LatexCommand \index{last}
\end_inset
time you used
\emph on
snort
\emph default
, you would type:
\begin_deeper
\layout SGML
\layout SGML
\noindent
\layout SGML
\noindent
CTRL
\layout SGML
\noindent
R
\layout SGML
\noindent
then type
\begin_inset Quotes eld
\end_inset
snort
\begin_inset Quotes erd
\end_inset
.
\layout SGML
\layout Standard
\noindent
What you will see in the console
\begin_inset LatexCommand \index{console}
\end_inset
window
\begin_inset LatexCommand \index{window}
\end_inset
is:
\layout Code
(reverse-i-search)`':
\layout Standard
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
After you have typed what you are looking
\begin_inset LatexCommand \index{looking}
\end_inset
for, use the
\family default
\begin_inset LatexCommand \index{default}
\end_inset
CTRL-R key
\begin_inset LatexCommand \index{key}
\end_inset
combination to scroll
\begin_inset LatexCommand \index{scroll}
\end_inset
backward through the history.
\begin_inset LatexCommand \index{history}
\end_inset
\layout Standard
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
Use
\family default
\begin_inset LatexCommand \index{default}
\end_inset
CTRL-R repeatedly
\begin_inset LatexCommand \index{repeatedly}
\end_inset
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
to find
\begin_inset LatexCommand \index{find}
\end_inset
\family default
\begin_inset LatexCommand \index{default}
\end_inset
every
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
reference
\begin_inset LatexCommand \index{reference}
\end_inset
to the string
\begin_inset LatexCommand \index{string}
\end_inset
you've entered.
\begin_inset LatexCommand \index{entered}
\end_inset
Once you've found
\begin_inset LatexCommand \index{found}
\end_inset
the command
\begin_inset LatexCommand \index{command}
\end_inset
you're looking
\begin_inset LatexCommand \index{looking}
\end_inset
for
\family default
\begin_inset LatexCommand \index{default}
\end_inset
,
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
use [Enter] to execute
\begin_inset LatexCommand \index{execute}
\end_inset
it.
\layout Standard
Alternatively,
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
using the right or left
\begin_inset LatexCommand \index{left}
\end_inset
arrow keys
\begin_inset LatexCommand \index{keys}
\end_inset
will place
\begin_inset LatexCommand \index{place}
\end_inset
the command
\begin_inset LatexCommand \index{command}
\end_inset
on an actual
\begin_inset LatexCommand \index{actual}
\end_inset
command line
\begin_inset LatexCommand \index{line}
\end_inset
so you can
\family default
\begin_inset LatexCommand \index{default}
\end_inset
edit
\begin_inset LatexCommand \index{edit}
\end_inset
it.
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
last sentence left because as Chris pointed out you can't assume that someone
will read this start to finish.
They may just look at a few commands or just 1 section.
\end_inset
\end_deeper
\layout Section
Other Key combinations
\begin_inset LatexCommand \label{other-Key-combinations}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
it would be nice to do this all on one line.
But I think I would have to do the entire \SpecialChar \ldots{}
\SpecialChar \ldots{}
\SpecialChar \ldots{}
and then I'd be writing SGML (ruining the point of using LyX :P).
Re-did the style of the command here\SpecialChar \ldots{}
\end_inset
\layout Standard
GNU/Linux shells
\begin_inset LatexCommand \index{shells}
\end_inset
have many shortcut
\begin_inset LatexCommand \index{shortcut}
\end_inset
keys which
\begin_inset LatexCommand \index{which}
\end_inset
you can use to speed
\begin_inset LatexCommand \index{speed}
\end_inset
up your work,
\begin_inset LatexCommand \index{work}
\end_inset
below is a rough
\begin_inset LatexCommand \index{rough}
\end_inset
list of some (also see CTRL-R the history
\begin_inset LatexCommand \index{history}
\end_inset
section
\begin_inset LatexCommand \index{section}
\end_inset
of the commands,
\begin_inset LatexCommand \index{commands}
\end_inset
over here,
\begin_inset LatexCommand \ref{the-command-line-history}
\end_inset
).
\layout SGML
\layout SGML
The CTRLD the
\begin_inset Quotes eld
\end_inset
end-of-file
\begin_inset Quotes erd
\end_inset
(EOF) key combination can be used to quickly log out of any terminal.
CTRL-D is also used in programs such as
\emph on
\begin_inset Quotes eld
\end_inset
at
\begin_inset Quotes erd
\end_inset
\emph default
to signal that you have finished typing your commands (the EOF command).
\layout SGML
\layout SGML
\layout SGML
The CTRLZ key combination
is used to stop a process.
It can be used to put something in the background temporarily.
\layout SGML
\layout SGML
\noindent
For example, if you were editing a file with
\emph on
vim
\emph default
or
\emph on
emacs
\emph default
just press CTRL-Z to regain control of the terminal do what you want and
then type
\emph on
fg
\emph default
to bring it back.
\layout SGML
For further information please see
\begin_inset LatexCommand \ref{controlling-processes}
\end_inset
.
\layout SGML
\layout SGML
\layout SGML
If
\emph on
fg
\emph default
doesn't work
\layout SGML
If
\emph on
fg
\emph default
doesn't work you may need to type
\emph on
jobs
\emph default
and then
\emph on
fg job_name or fg job_number
\emph default
\layout SGML
\layout SGML
The CTRLA and
CTRLE key combinations
are used for going to the start and end of the line on the command line.
Use CTRLA to jump
to the start of the line, and CTRLE
to jump to the end of the line.
\layout SGML
The CTRLK
key combination can be used to cut or delete what is currently in front
of the cursor.
\layout SGML
The CTRLY key
combination can be used to paste the last thing you deleted (using CTRL-K
or CTRL-W).
\layout SGML
The CTRLW key
combination can be used to cut or delete the entire line that has being
typed.
\layout Section
Virtual Terminals and screen
\begin_inset LatexCommand \label{virtual-terminals}
\end_inset
\layout SGML
\noindent
Using the key combination
\layout SGML
\noindent
\layout SGML
\noindent
ALT
\layout SGML
\noindent
F*
\layout SGML
\layout SGML
\noindent
keys you may change to different virtual terminals.
You will have several (usually 6) virtual terminals setup with shells.
Number 7 is usually setup with X you need to use CTRL-ALT-F* to change
to a terminal from within X (X as in the X windowing system).
\layout SGML
\layout Description
screen
\begin_inset LatexCommand \index{screen}
\end_inset
is a great
\begin_inset LatexCommand \index{great}
\end_inset
program that allows
\begin_inset LatexCommand \index{allows}
\end_inset
you to switch
\begin_inset LatexCommand \index{switch}
\end_inset
between multiple
\begin_inset LatexCommand \index{multiple}
\end_inset
virtual
\begin_inset LatexCommand \index{virtual}
\end_inset
terminals
\begin_inset LatexCommand \index{terminals}
\end_inset
on the one physical
\begin_inset LatexCommand \index{physical}
\end_inset
terminal
\begin_inset LatexCommand \index{terminal}
\end_inset
that you are using.
Its a command-line
\begin_inset LatexCommand \index{command-line}
\end_inset
based window
\begin_inset LatexCommand \index{window}
\end_inset
manager, clearly this isn't that useful if you do have virtual
\begin_inset LatexCommand \index{virtual}
\end_inset
terminals, but its amazingly useful when you log
\begin_inset LatexCommand \index{log}
\end_inset
into machines
\begin_inset LatexCommand \index{machines}
\end_inset
remotely, using ssh
\begin_inset LatexCommand \index{ssh}
\end_inset
and similar,
\begin_inset LatexCommand \index{similar}
\end_inset
see
\begin_inset LatexCommand \ref{remote-administration}
\end_inset
.
It works
\begin_inset LatexCommand \index{works}
\end_inset
on key-combinations,
\begin_inset LatexCommand \index{key-combinations}
\end_inset
you type
\begin_deeper
\layout Code
screen
\layout SGML
On the command-line to begin.
Now you start with one virtual terminal by default, but using the key combinati
on
\layout SGML
\noindent
CTRL
\layout SGML
\noindent
A
\layout SGML
and then hitting "C" you can create another virtual terminal
to use.
\layout SGML
Use CTRLN
to go to the next virtual terminal and CTRLP
to go to the previous virtual terminal.
Also try hitting CTRLA
to go backwards and forwards between two particular terminals.
\layout SGML
\layout Standard
screen
\begin_inset LatexCommand \index{screen}
\end_inset
also has various other abilities
\begin_inset LatexCommand \index{abilities}
\end_inset
that you can test
\begin_inset LatexCommand \index{test}
\end_inset
out.
The documentation
\begin_inset LatexCommand \index{documentation}
\end_inset
and guides are well written
\begin_inset LatexCommand \index{written}
\end_inset
so please feel free
\begin_inset LatexCommand \index{free}
\end_inset
to read
\begin_inset LatexCommand \index{read}
\end_inset
the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
or try
\begin_inset LatexCommand \index{try}
\end_inset
searching the internet.
\begin_inset LatexCommand \index{internet}
\end_inset
\end_deeper
\layout Chapter
Help
\begin_inset LatexCommand \label{Help}
\end_inset
\layout Standard
The help
\begin_inset LatexCommand \index{help}
\end_inset
chapter provides
\begin_inset LatexCommand \index{provides}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on how you may access
\begin_inset LatexCommand \index{access}
\end_inset
the documentation
\begin_inset LatexCommand \index{documentation}
\end_inset
of the GNU/Linux system.
\begin_inset LatexCommand \index{system}
\end_inset
There is normally a document
\begin_inset LatexCommand \index{document}
\end_inset
describing every single tool
\begin_inset LatexCommand \index{tool}
\end_inset
you have installed,
\begin_inset LatexCommand \index{installed}
\end_inset
even if its only brief\SpecialChar \ldots{}
\layout Description
man
\begin_inset LatexCommand \index{man}
\end_inset
This command
\begin_inset LatexCommand \index{command}
\end_inset
displays summary
\begin_inset LatexCommand \index{summary}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on a program
\begin_inset LatexCommand \index{program}
\end_inset
from an online
\begin_inset LatexCommand \index{online}
\end_inset
manual.
\begin_inset LatexCommand \index{manual}
\end_inset
For example
\begin_inset LatexCommand \index{example}
\end_inset
typing
\emph on
man man
\begin_inset LatexCommand \index{man}
\end_inset
\emph default
will bring up the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
for man
\begin_inset LatexCommand \index{man}
\end_inset
(the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
viewer).
Note: q is the quit
\begin_inset LatexCommand \index{quit}
\end_inset
key.
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
man program_name
\layout SGML
\layout SGML
Also try
\layout SGML
Specifying the section of the manual page, sometimes the man page
is different for the same tool in different sections, note sections are
numbered 1 to 9.
Use apropos to find which section number to look in.
\layout SGML
\layout SGML
\layout SGML
The syntax to look at a different section is:
\layout SGML
\layout SGML
man section_number tool_name
\layout SGML
\layout SGML
For example:
\layout SGML
\layout SGML
man 2 time
\layout SGML
\layout SGML
This will show you the man page called time in section 2, the equivalent
page in section 1 is completely different
\layout SGML
\layout SGML
\end_deeper
\layout Description
man\SpecialChar ~
-K\SpecialChar ~
keyword
\begin_inset LatexCommand \index{keyword}
\end_inset
Search
\begin_inset LatexCommand \index{Search}
\end_inset
the manual
\begin_inset LatexCommand \index{manual}
\end_inset
pages for a string,
\begin_inset LatexCommand \index{string}
\end_inset
as in it will search
\begin_inset LatexCommand \index{search}
\end_inset
all manual
\begin_inset LatexCommand \index{manual}
\end_inset
pages for a particular
\begin_inset LatexCommand \index{particular}
\end_inset
string
\begin_inset LatexCommand \index{string}
\end_inset
within each individual
\begin_inset LatexCommand \index{individual}
\end_inset
man
\begin_inset LatexCommand \index{man}
\end_inset
page,
\begin_inset LatexCommand \index{page}
\end_inset
it will then prompt
\begin_inset LatexCommand \index{prompt}
\end_inset
whether you would like to view
\begin_inset LatexCommand \index{view}
\end_inset
each page
\begin_inset LatexCommand \index{page}
\end_inset
it will find.
\begin_inset LatexCommand \index{find}
\end_inset
Use double
\begin_inset LatexCommand \index{double}
\end_inset
quotes
\begin_inset Quotes eld
\end_inset
and
\begin_inset Quotes erd
\end_inset
if there are spaces
\begin_inset LatexCommand \index{spaces}
\end_inset
in the string
\begin_inset LatexCommand \index{string}
\end_inset
you are typing.
\begin_deeper
\layout SGML
\layout SGML
Speed issue
\layout SGML
Please be warned that this method is going to be really, really slow.
You are searching *all* man pages for a string
\layout SGML
\end_deeper
\layout Description
man\SpecialChar ~
-f\SpecialChar ~
command
\begin_inset LatexCommand \index{command}
\end_inset
This will list
\begin_inset LatexCommand \index{list}
\end_inset
details
\begin_inset LatexCommand \index{details}
\end_inset
associated
\begin_inset LatexCommand \index{associated}
\end_inset
with the command.
The root
\begin_inset LatexCommand \index{root}
\end_inset
user
\begin_inset LatexCommand \index{user}
\end_inset
must run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
makewhatis
\emph default
(see below) before this command
\begin_inset LatexCommand \index{command}
\end_inset
will work.
\begin_inset LatexCommand \index{work}
\end_inset
\begin_deeper
\layout SGML
\series medium
\layout SGML
\series medium
\series default
Equivalent to
\emph on
whatis
\series medium
\emph default
\layout SGML
\series medium
\series default
This command is the same as running
\emph on
whatis
\layout SGML
\series medium
\layout SGML
\series medium
\end_deeper
\layout Description
info
\begin_inset LatexCommand \index{info}
\end_inset
Provides a more
\begin_inset LatexCommand \index{more}
\end_inset
detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
hyper-text manual
\begin_inset LatexCommand \index{manual}
\end_inset
on a particular
\begin_inset LatexCommand \index{particular}
\end_inset
command,
\begin_inset LatexCommand \index{command}
\end_inset
this only works
\begin_inset LatexCommand \index{works}
\end_inset
for some commands.
\begin_inset LatexCommand \index{commands}
\end_inset
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
info program_name
\end_deeper
\layout Description
whatis
\begin_inset LatexCommand \index{whatis}
\end_inset
Displays a one line
\begin_inset LatexCommand \index{line}
\end_inset
description
\begin_inset LatexCommand \index{description}
\end_inset
of what a program
\begin_inset LatexCommand \index{program}
\end_inset
does.
The string
\begin_inset LatexCommand \index{string}
\end_inset
needs to be an exact
\begin_inset LatexCommand \index{exact}
\end_inset
match, otherwise
\emph on
whatis
\emph default
won't output
\begin_inset LatexCommand \index{output}
\end_inset
anything.
Relies on the whatis
\begin_inset LatexCommand \index{whatis}
\end_inset
database (see below).
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
whatis program_name
\end_deeper
\layout Description
\noindent
makewhatis
\begin_inset LatexCommand \index{makewhatis}
\end_inset
Make the whatis
\begin_inset LatexCommand \index{whatis}
\end_inset
database for
\emph on
apropos
\emph default
,
\emph on
whatis
\emph default
and
\emph on
man
\begin_inset LatexCommand \index{man}
\end_inset
-f.
\begin_inset LatexCommand \index{-f}
\end_inset
\emph default
\begin_deeper
\layout SGML
\noindent
\layout SGML
\noindent
Root Privileges
\layout SGML
\noindent
This takes some time and you require root privileges to do this.
\layout SGML
\noindent
\end_deeper
\layout Description
apropos
\begin_inset LatexCommand \index{apropos}
\end_inset
Searches
\begin_inset LatexCommand \index{Searches}
\end_inset
the whatis
\begin_inset LatexCommand \index{whatis}
\end_inset
database for strings,
\begin_inset LatexCommand \index{strings}
\end_inset
similar
\begin_inset LatexCommand \index{similar}
\end_inset
to
\emph on
whatis
\emph default
except it finds
\begin_inset LatexCommand \index{finds}
\end_inset
and prints
\begin_inset LatexCommand \index{prints}
\end_inset
anything matching
\begin_inset LatexCommand \index{matching}
\end_inset
the string
\begin_inset LatexCommand \index{string}
\end_inset
(or any part
\begin_inset LatexCommand \index{part}
\end_inset
of the string).
Also relies on the whatis
\begin_inset LatexCommand \index{whatis}
\end_inset
database (see above).
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
apropos string
\layout SGML
\layout SGML
Equivalent to...
\layout SGML
\emph on
apropos
\emph default
is the same as doing
\emph on
man -k
\emph default
(lowercase k).
\layout SGML
\end_deeper
\layout SGML
\layout SGML
Please note
\layout SGML
\layout SGML
You need to run
\emph on
makewhatis
\emph default
(as root) so
\emph on
whatis
\emph default
,
\emph on
man -f
\emph default
and
\emph on
apropos
\emph default
will work.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
Also try
\layout SGML
\layout SGML
Using a program with the
\emph on
-?
\emph default
,
\emph on
--h
\emph default
,
\emph on
--help
\emph default
, and the
\emph on
-h
\emph default
options, they will display very short summary information on the command
usage options.
\layout SGML
\layout SGML
\layout Chapter
Directing Input/Output
\begin_inset LatexCommand \label{Directing-input-ouput}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
brand new section
\layout Standard
hopefully my File Stream theory is correct, its based off C as well as UNIX\SpecialChar \ldots{}
\layout Standard
Concept definitions have never being used before\SpecialChar \ldots{}
(have been used once about
alises)
\layout Standard
kind of out of place in this guide but I don't know how else to put it for
now.
\end_inset
\layout Standard
The directing input/output chapter explains
\begin_inset LatexCommand \index{explains}
\end_inset
how you can use a program
\begin_inset LatexCommand \index{program}
\end_inset
and send
\begin_inset LatexCommand \index{send}
\end_inset
its output
\begin_inset LatexCommand \index{output}
\end_inset
to a file
\begin_inset LatexCommand \index{file}
\end_inset
or to another command
\begin_inset LatexCommand \index{command}
\end_inset
that you wish to use.
This technique
\begin_inset LatexCommand \index{technique}
\end_inset
is very powerful
\begin_inset LatexCommand \index{powerful}
\end_inset
and there are a number
\begin_inset LatexCommand \index{number}
\end_inset
of ways of doing this.
\layout Section
Concept Definitions
\begin_inset LatexCommand \label{concept-definitions}
\end_inset
\layout Standard
All three of the following
\begin_inset LatexCommand \index{following}
\end_inset
definitions
\begin_inset LatexCommand \index{definitions}
\end_inset
are called
\begin_inset Quotes eld
\end_inset
File
\begin_inset LatexCommand \index{File}
\end_inset
Streams.
\begin_inset LatexCommand \index{Streams}
\end_inset
\begin_inset Quotes erd
\end_inset
They hold information
\begin_inset LatexCommand \index{information}
\end_inset
that is either received
\begin_inset LatexCommand \index{received}
\end_inset
from somewhere or sent to somewhere.
In a UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system,
\begin_inset LatexCommand \index{system}
\end_inset
the keyboard
\begin_inset LatexCommand \index{keyboard}
\end_inset
input (standard input), information
\begin_inset LatexCommand \index{information}
\end_inset
printed to the screen
\begin_inset LatexCommand \index{screen}
\end_inset
(standard output) and error
\begin_inset LatexCommand \index{error}
\end_inset
output
\begin_inset LatexCommand \index{output}
\end_inset
(also printed
\begin_inset LatexCommand \index{printed}
\end_inset
to the screen) are treated
\begin_inset LatexCommand \index{treated}
\end_inset
as separate
\begin_inset LatexCommand \index{separate}
\end_inset
File Streams.
\begin_inset LatexCommand \index{Streams}
\end_inset
\layout Description
Standard\SpecialChar ~
output Standard
\begin_inset LatexCommand \index{standard output}
\end_inset
output
\begin_inset LatexCommand \index{output, standard}
\end_inset
is the output
\begin_inset LatexCommand \index{output}
\end_inset
from the program
\begin_inset LatexCommand \index{program}
\end_inset
printed
\begin_inset LatexCommand \index{printed}
\end_inset
to the screen,
\begin_inset LatexCommand \index{screen}
\end_inset
not including
\begin_inset LatexCommand \index{including}
\end_inset
error output
\begin_inset LatexCommand \index{output}
\end_inset
(see below).
\layout Description
Standard\SpecialChar ~
input Standard
\begin_inset LatexCommand \index{standard input}
\end_inset
input
\begin_inset LatexCommand \index{input, standard}
\end_inset
is the input
\begin_inset LatexCommand \index{input}
\end_inset
from the user.
\begin_inset LatexCommand \index{user}
\end_inset
Normally the keyboard
\begin_inset LatexCommand \index{keyboard}
\end_inset
is used as the standard
\begin_inset LatexCommand \index{standard}
\end_inset
input
\begin_inset LatexCommand \index{input}
\end_inset
\begin_inset LatexCommand \index{standard input}
\end_inset
device in a UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system.
\begin_inset LatexCommand \index{system}
\end_inset
\layout Description
Standard\SpecialChar ~
error Standard
\begin_inset LatexCommand \index{Standard}
\end_inset
error
\begin_inset LatexCommand \index{error}
\end_inset
is error
\begin_inset LatexCommand \index{error}
\end_inset
output
\begin_inset LatexCommand \index{output}
\end_inset
from programs.
\begin_inset LatexCommand \index{programs}
\end_inset
This output
\begin_inset LatexCommand \index{output}
\end_inset
is also sent to the screen
\begin_inset LatexCommand \index{screen}
\end_inset
and will normally be seen mixed
\begin_inset LatexCommand \index{mixed}
\end_inset
in with standard
\begin_inset LatexCommand \index{standard}
\end_inset
output.
\begin_inset LatexCommand \index{standard output}
\end_inset
\begin_inset LatexCommand \index{output}
\end_inset
The difference
\begin_inset LatexCommand \index{difference}
\end_inset
between standard
\begin_inset LatexCommand \index{standard}
\end_inset
output
\begin_inset LatexCommand \index{standard output}
\end_inset
\begin_inset LatexCommand \index{output}
\end_inset
and standard
\begin_inset LatexCommand \index{standard}
\end_inset
error
\begin_inset LatexCommand \index{standard error}
\end_inset
is that standard error
\begin_inset LatexCommand \index{error}
\end_inset
is unbuffered
\begin_inset LatexCommand \index{unbuffered}
\end_inset
(it appears immediately on the screen) and standard
\begin_inset LatexCommand \index{standard}
\end_inset
error
\begin_inset LatexCommand \index{error}
\end_inset
is only printed
\begin_inset LatexCommand \index{printed}
\end_inset
when something goes wrong
\begin_inset LatexCommand \index{wrong}
\end_inset
(it will give you details
\begin_inset LatexCommand \index{details}
\end_inset
of what went wrong).
\begin_inset Note
collapsed true
\layout Standard
example of very well written section :)
\end_inset
\layout Section
Usage
\begin_inset LatexCommand \label{usage-input-output}
\end_inset
\layout Description
>
\begin_inset LatexCommand \index{>}
\end_inset
The greater
\begin_inset LatexCommand \index{greater}
\end_inset
than symbol
\begin_inset LatexCommand \index{symbol}
\end_inset
is used to send
\begin_inset LatexCommand \index{send}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
somewhere (for example
\begin_inset LatexCommand \index{example}
\end_inset
a text
\begin_inset LatexCommand \index{text}
\end_inset
file)
\begin_deeper
\layout Standard
Example:
\layout Code
cat file1 file2 > file1_and_2.txt
\layout Standard
This will concatenate
\begin_inset LatexCommand \index{concatenate}
\end_inset
the files
\begin_inset LatexCommand \index{files}
\end_inset
together into one big file
\begin_inset LatexCommand \index{file}
\end_inset
named
\begin_inset LatexCommand \index{named}
\end_inset
\begin_inset Quotes eld
\end_inset
file1_and_2.txt
\begin_inset Quotes erd
\end_inset
.
Note that this will overwrite
\begin_inset LatexCommand \index{overwrite}
\end_inset
any existing
\begin_inset LatexCommand \index{existing}
\end_inset
file.
\end_deeper
\layout Description
\noindent
<
\begin_inset LatexCommand \index{<}
\end_inset
The less
\begin_inset LatexCommand \index{less}
\end_inset
than symbol
\begin_inset LatexCommand \index{symbol}
\end_inset
will insert
\begin_inset LatexCommand \index{insert}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
from somewhere (a text
\begin_inset LatexCommand \index{text}
\end_inset
file) as if you typed it yourself.
Often used with commands
\begin_inset LatexCommand \index{commands}
\end_inset
that are designed
\begin_inset LatexCommand \index{designed}
\end_inset
to get information
\begin_inset LatexCommand \index{information}
\end_inset
from standard
\begin_inset LatexCommand \index{standard}
\end_inset
input
\begin_inset LatexCommand \index{input}
\end_inset
only.
\begin_deeper
\layout Standard
\noindent
For example
\begin_inset LatexCommand \index{example}
\end_inset
(using tr):
\layout Code
tr [A-Z] [a-z] < fileName.txt > fileNameNew.txt
\layout Standard
The example
\begin_inset LatexCommand \index{example}
\end_inset
above would insert
\begin_inset LatexCommand \index{insert}
\end_inset
the contents
\begin_inset LatexCommand \index{contents}
\end_inset
of
\begin_inset Quotes eld
\end_inset
fileName.txt
\begin_inset Quotes erd
\end_inset
into the input
\begin_inset LatexCommand \index{input}
\end_inset
of
\emph on
tr
\emph default
and output
\begin_inset LatexCommand \index{output}
\end_inset
the results
\begin_inset LatexCommand \index{results}
\end_inset
to
\begin_inset Quotes eld
\end_inset
fileNameNew.txt
\begin_inset Quotes erd
\end_inset
.
\end_deeper
\layout Description
\noindent
>>
\begin_inset LatexCommand \index{>>}
\end_inset
The >> symbol
\begin_inset LatexCommand \index{symbol}
\end_inset
appends (adds) information
\begin_inset LatexCommand \index{information}
\end_inset
to the end
\begin_inset LatexCommand \index{end}
\end_inset
of a file
\begin_inset LatexCommand \index{file}
\end_inset
or creates one if the file
\begin_inset LatexCommand \index{file}
\end_inset
doesn't exist.
\begin_inset LatexCommand \index{exist}
\end_inset
\layout Description
<<
\begin_inset LatexCommand \index{<<}
\end_inset
The << symbol
\begin_inset LatexCommand \index{symbol}
\end_inset
is sometimes used with commands
\begin_inset LatexCommand \index{commands}
\end_inset
that use standard
\begin_inset LatexCommand \index{standard}
\end_inset
input
\begin_inset LatexCommand \index{input}
\end_inset
\begin_inset LatexCommand \index{standard input}
\end_inset
to take
\begin_inset LatexCommand \index{take}
\end_inset
information.
\begin_inset LatexCommand \index{information}
\end_inset
You simply type
\emph on
<< word
\begin_inset LatexCommand \index{word}
\end_inset
\emph default
(where word
\begin_inset LatexCommand \index{word}
\end_inset
can be any string) at the end
\begin_inset LatexCommand \index{end}
\end_inset
of the command.
\begin_inset LatexCommand \index{command}
\end_inset
\begin_deeper
\layout Standard
The command
\begin_inset LatexCommand \index{command}
\end_inset
takes your input
\begin_inset LatexCommand \index{input}
\end_inset
until
\begin_inset LatexCommand \index{until}
\end_inset
you type
\begin_inset Quotes eld
\end_inset
word
\begin_inset Quotes erd
\end_inset
, which
\begin_inset LatexCommand \index{which}
\end_inset
causes the command
\begin_inset LatexCommand \index{command}
\end_inset
to terminate
\begin_inset LatexCommand \index{terminate}
\end_inset
and process
\begin_inset LatexCommand \index{process}
\end_inset
the input.
\begin_inset LatexCommand \index{input}
\end_inset
\layout Standard
Using << is an alternative
\begin_inset LatexCommand \index{alternative}
\end_inset
to using CTRL-D (EOF key)
\emph on
,
\emph default
except it uses a string
\begin_inset LatexCommand \index{string}
\end_inset
to perform
\begin_inset LatexCommand \index{perform}
\end_inset
the end-of-file
\begin_inset LatexCommand \index{end-of-file}
\end_inset
function.
\begin_inset LatexCommand \index{function}
\end_inset
\layout Standard
For example type "cat" (with no options\SpecialChar \ldots{}
) and it will work
\begin_inset LatexCommand \index{work}
\end_inset
on standard
\begin_inset LatexCommand \index{standard}
\end_inset
input.
\begin_inset LatexCommand \index{input}
\end_inset
\begin_inset LatexCommand \index{standard input}
\end_inset
\layout Standard
To stop
\begin_inset LatexCommand \index{stop}
\end_inset
entering standard
\begin_inset LatexCommand \index{standard}
\end_inset
input
\begin_inset LatexCommand \index{input}
\end_inset
\begin_inset LatexCommand \index{standard input}
\end_inset
you would normally hit
\begin_inset LatexCommand \index{hit}
\end_inset
CTRL-D.
\layout Standard
As an alternative
\begin_inset LatexCommand \index{alternative}
\end_inset
you can type "cat << FINISHED", then type what you want.
\layout Standard
When you are finished,
\begin_inset LatexCommand \index{finished}
\end_inset
instead of hitting
\begin_inset LatexCommand \index{hitting}
\end_inset
CTRL-D you could type "FINISHED"
\begin_inset LatexCommand \index{FINISHED}
\end_inset
and it will end
\begin_inset LatexCommand \index{end}
\end_inset
(the word
\begin_inset LatexCommand \index{word}
\end_inset
FINISHED will not be recorded).
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
I don't personally use that but it might be useful for some people and other
people said this explanation made perfect sense to them\SpecialChar \ldots{}
\end_inset
\end_deeper
\layout Description
\noindent
2>
\begin_inset LatexCommand \index{2>}
\end_inset
Redirects error
\begin_inset LatexCommand \index{error}
\end_inset
output.
\begin_inset LatexCommand \index{output}
\end_inset
For example,
\begin_inset LatexCommand \index{example}
\end_inset
to redirect
\begin_inset LatexCommand \index{redirect}
\end_inset
the error
\begin_inset LatexCommand \index{error}
\end_inset
output
\begin_inset LatexCommand \index{output}
\end_inset
to /dev/null, so you do not see it, simply append this to the end of another
command\SpecialChar \ldots{}
\begin_deeper
\layout Standard
\noindent
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
make some_file 2> /dev/null
\layout Standard
Runs
\begin_inset LatexCommand \index{Runs}
\end_inset
make on a file
\begin_inset LatexCommand \index{file}
\end_inset
and send
\begin_inset LatexCommand \index{send}
\end_inset
all error
\begin_inset LatexCommand \index{error}
\end_inset
output
\begin_inset LatexCommand \index{output}
\end_inset
to /dev/null
\end_deeper
\layout Description
|
\begin_inset LatexCommand \index{|}
\end_inset
The
\begin_inset Quotes eld
\end_inset
pipe
\begin_inset Quotes erd
\end_inset
\begin_inset LatexCommand \index{pipe}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
allows
\begin_inset LatexCommand \index{allows}
\end_inset
the output
\begin_inset LatexCommand \index{output}
\end_inset
of one command
\begin_inset LatexCommand \index{command}
\end_inset
to be sent to the input
\begin_inset LatexCommand \index{input}
\end_inset
of another.
\begin_deeper
\layout Standard
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
\noindent
cat file1.txt file2.txt | less
\layout Standard
\noindent
Concatenates
\begin_inset LatexCommand \index{Concatenates}
\end_inset
the files
\begin_inset LatexCommand \index{files}
\end_inset
together, then runs
\begin_inset LatexCommand \index{runs}
\end_inset
\emph on
less
\emph default
on them.
If you are only going to look
\begin_inset LatexCommand \index{look}
\end_inset
at a single file,
\begin_inset LatexCommand \index{file}
\end_inset
you would simply use
\emph on
less
\emph default
on the file\SpecialChar \ldots{}
\end_deeper
\layout Description
\noindent
tee
\begin_inset LatexCommand \index{tee}
\end_inset
Sends
\begin_inset LatexCommand \index{Sends}
\end_inset
output of a program
\begin_inset LatexCommand \index{program}
\end_inset
to a file
\begin_inset LatexCommand \index{file}
\end_inset
and to standard
\begin_inset LatexCommand \index{standard}
\end_inset
output.
\begin_inset LatexCommand \index{standard output}
\end_inset
\begin_inset LatexCommand \index{output}
\end_inset
Think of it as a
\family sans
\begin_inset LatexCommand \index{sans}
\end_inset
T
\family default
\begin_inset LatexCommand \index{default}
\end_inset
intersection\SpecialChar \ldots{}
it goes two ways.
\begin_deeper
\layout Standard
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
ls /home/user | tee my_directories.txt
\layout Standard
Lists
\begin_inset LatexCommand \index{Lists}
\end_inset
the files
\begin_inset LatexCommand \index{files}
\end_inset
(displays the output
\begin_inset LatexCommand \index{output}
\end_inset
on the screen) and sends
\begin_inset LatexCommand \index{sends}
\end_inset
the output to a file:
\begin_inset LatexCommand \index{file}
\end_inset
\begin_inset Quotes eld
\end_inset
my_directories.txt
\begin_inset Quotes erd
\end_inset
.
\end_deeper
\layout Description
\noindent
&>
\begin_inset LatexCommand \index{&>}
\end_inset
Redirects
\begin_inset LatexCommand \index{Redirects}
\end_inset
standard
\begin_inset LatexCommand \index{output, standard}
\end_inset
output
\begin_inset LatexCommand \index{standard output}
\end_inset
\begin_inset LatexCommand \index{output}
\end_inset
and error
\begin_inset LatexCommand \index{error}
\end_inset
output
\begin_inset LatexCommand \index{output, error}
\end_inset
to a specific
\begin_inset LatexCommand \index{specific}
\end_inset
location.
\begin_inset LatexCommand \index{location}
\end_inset
\begin_deeper
\layout Standard
\noindent
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
make &> /dev/null
\layout Standard
Sends
\begin_inset LatexCommand \index{Sends}
\end_inset
both error
\begin_inset LatexCommand \index{error}
\end_inset
output
\begin_inset LatexCommand \index{output}
\end_inset
and standard
\begin_inset LatexCommand \index{standard}
\end_inset
output
\begin_inset LatexCommand \index{standard output}
\end_inset
\begin_inset LatexCommand \index{output}
\end_inset
to /dev/null so you won't see anything\SpecialChar \ldots{}
\end_deeper
\layout Section
Command Substitution
\begin_inset LatexCommand \label{command-substitution}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
these two sub-sections (6.3, 6.4) are not formatted like any other sub-section.
Should probably fix them eventually.
--broken into 3 subsections, looks better now
\layout Standard
And I think it comes out ok\SpecialChar \ldots{}
, should I only show one method? (to save space
and be more concise?)
\end_inset
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
substitution
\begin_inset LatexCommand \index{substitution, command}
\end_inset
\begin_inset LatexCommand \index{command substitution}
\end_inset
is basically
\begin_inset LatexCommand \index{basically}
\end_inset
another way to do a pipe,
\begin_inset LatexCommand \index{pipe}
\end_inset
you can use pipes
\begin_inset LatexCommand \index{pipes}
\end_inset
and command
\begin_inset LatexCommand \index{command}
\end_inset
substitution interchangeably,
\begin_inset LatexCommand \index{interchangeably}
\end_inset
it's up to you which
\begin_inset LatexCommand \index{which}
\end_inset
one you find easier\SpecialChar \ldots{}
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
substitution can be done in two distinct
\begin_inset LatexCommand \index{distinct}
\end_inset
ways.
\layout Description
\begin_inset Note
collapsed false
\layout Standard
these descriptions below were subsections but they don't look too good in
the output because they get there own HTML page each! And I can't get bold
to work in standard mode!!!
\end_inset
\layout Description
Method\SpecialChar ~
One\SpecialChar ~
(back-quotes)
\begin_inset LatexCommand \label{command-substitution-back-quotes}
\end_inset
\begin_deeper
\layout Standard
Simply type:
\layout Code
command_1 `command_2 -options`
\layout Standard
This will execute
\begin_inset LatexCommand \index{execute}
\end_inset
\begin_inset Quotes eld
\end_inset
command_2
\begin_inset Quotes erd
\end_inset
and it's output
\begin_inset LatexCommand \index{output}
\end_inset
will become the input
\begin_inset LatexCommand \index{input}
\end_inset
to
\begin_inset Quotes eld
\end_inset
command_1
\begin_inset Quotes erd
\end_inset
.
\layout SGML
\layout SGML
Backquote key
\layout SGML
\layout SGML
The back-quote key is usually located at the same place as the tilde, above
the [Tab] key.
\layout SGML
\layout SGML
\end_deeper
\layout Description
Method\SpecialChar ~
Two\SpecialChar ~
(dollars\SpecialChar ~
sign)
\begin_inset LatexCommand \label{command-substitution-dollars-sign}
\end_inset
\begin_deeper
\layout Standard
Simply type:
\layout Code
command_1 $(command_2)
\layout Standard
This will execute
\begin_inset LatexCommand \index{execute}
\end_inset
\begin_inset Quotes eld
\end_inset
command_2
\begin_inset Quotes erd
\end_inset
and it's output
\begin_inset LatexCommand \index{output}
\end_inset
will become the input
\begin_inset LatexCommand \index{input}
\end_inset
to
\begin_inset Quotes eld
\end_inset
command_1
\begin_inset Quotes erd
\end_inset
.
\end_deeper
\layout Description
Using\SpecialChar ~
the\SpecialChar ~
pipe\SpecialChar ~
instead
\begin_inset LatexCommand \label{command-substitution-pipe}
\end_inset
\begin_deeper
\layout Standard
You can of course use pipes
\begin_inset LatexCommand \index{pipes}
\end_inset
to do the same thing, if you don't know what a pipe
\begin_inset LatexCommand \index{pipe}
\end_inset
is, please see
\begin_inset LatexCommand \ref{usage-input-output}
\end_inset
.
For example
\begin_inset LatexCommand \index{example}
\end_inset
instead of doing:
\layout Code
less $cat file1.txt file2.txt
\layout Standard
You could do:
\layout Code
cat file1.txt file2.txt | less
\layout Standard
And end
\begin_inset LatexCommand \index{end}
\end_inset
up with exactly
\begin_inset LatexCommand \index{exactly}
\end_inset
the same result,
\begin_inset LatexCommand \index{result}
\end_inset
it's up to you which
\begin_inset LatexCommand \index{which}
\end_inset
way you find
\begin_inset LatexCommand \index{find}
\end_inset
easier.
\end_deeper
\layout Section
Performing more than one command
\begin_inset LatexCommand \label{performing-more-than-one-command}
\end_inset
\layout Description
Executing\SpecialChar ~
the\SpecialChar ~
second\SpecialChar ~
command\SpecialChar ~
only\SpecialChar ~
if\SpecialChar ~
the\SpecialChar ~
first\SpecialChar ~
is\SpecialChar ~
successful
\begin_inset LatexCommand \label{execute-command-2-if-1-works}
\end_inset
\begin_inset LatexCommand \index{&&}
\end_inset
\begin_inset LatexCommand \index{command, more than one}
\end_inset
\begin_deeper
\layout Standard
To do this you would type:
\layout Code
command1 && command2
\layout Standard
command2
\begin_inset LatexCommand \index{command2}
\end_inset
will be executed if command1
\begin_inset LatexCommand \index{command1}
\end_inset
successfully completes (if command1 fails
\begin_inset LatexCommand \index{fails}
\end_inset
command2
\begin_inset LatexCommand \index{command2}
\end_inset
won't be run).
This is called a logical
\begin_inset LatexCommand \index{logical}
\end_inset
AND.
\begin_inset LatexCommand \index{AND}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
not sure if thats correct (the && explanation)
\end_inset
\end_deeper
\layout Description
Executing\SpecialChar ~
the\SpecialChar ~
second\SpecialChar ~
command\SpecialChar ~
only\SpecialChar ~
if\SpecialChar ~
the\SpecialChar ~
first\SpecialChar ~
fails
\begin_inset LatexCommand \label{execute-command-2-if-1-fails}
\end_inset
\begin_inset LatexCommand \index{||}
\end_inset
\begin_deeper
\layout Standard
To do this you would type:
\layout Code
command1 || command2
\layout Standard
command2
\begin_inset LatexCommand \index{command2}
\end_inset
will be executed if command1
\begin_inset LatexCommand \index{command1}
\end_inset
does not successfully
\begin_inset LatexCommand \index{successfully}
\end_inset
completes (if command1
\begin_inset LatexCommand \index{command1}
\end_inset
is successful
\begin_inset LatexCommand \index{successful}
\end_inset
command2 won't be run).
This is called a logical
\begin_inset LatexCommand \index{logical}
\end_inset
OR.
\begin_inset LatexCommand \index{OR}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
more useful in programming or shell scripting then in normal use but added
anyway\SpecialChar \ldots{}
\end_inset
\end_deeper
\layout Description
Executing\SpecialChar ~
commands\SpecialChar ~
sequentially
\begin_inset LatexCommand \label{executing-commands-sequentially}
\end_inset
\begin_inset LatexCommand \index{;}
\end_inset
\begin_deeper
\layout Standard
To execute
\begin_inset LatexCommand \index{execute}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
sequentially
\begin_inset LatexCommand \index{sequentially}
\end_inset
regardless of the success/failure of the previous
\begin_inset LatexCommand \index{previous}
\end_inset
you simply type:
\layout Code
\noindent
command1; command2
\layout Standard
\noindent
command2
\begin_inset LatexCommand \index{command2}
\end_inset
will execute
\begin_inset LatexCommand \index{execute}
\end_inset
once command1
\begin_inset LatexCommand \index{command1}
\end_inset
has completed.
\layout SGML
\noindent
\layout SGML
\noindent
More than two commands
\layout SGML
\noindent
You can continue to use ';' (semicolon) characters to do more and
more commands on the one line.
\layout SGML
\noindent
\end_deeper
\layout Chapter
\noindent
Working with the file-system
\begin_inset LatexCommand \label{Working-with-the-file-system}
\end_inset
\layout Standard
The working
\begin_inset LatexCommand \index{working}
\end_inset
with the file-system
\begin_inset LatexCommand \index{file-system}
\end_inset
chapter explains
\begin_inset LatexCommand \index{explains}
\end_inset
a number
\begin_inset LatexCommand \index{number}
\end_inset
of commands
\begin_inset LatexCommand \index{commands}
\end_inset
that you use to move
\begin_inset LatexCommand \index{move}
\end_inset
around the file
\begin_inset LatexCommand \index{file}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
hierarchy
\begin_inset LatexCommand \index{hierarchy}
\end_inset
and manipulate
\begin_inset LatexCommand \index{manipulate}
\end_inset
the files.
\begin_inset LatexCommand \index{files}
\end_inset
Also explained are finding
\begin_inset LatexCommand \index{finding}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
and how to mass-rename
\begin_inset LatexCommand \index{mass-rename}
\end_inset
files.
\layout Section
Moving around the filesystem
\begin_inset LatexCommand \label{using-filesystem}
\end_inset
\layout Description
cd
\begin_inset LatexCommand \index{cd}
\end_inset
Change
\begin_inset LatexCommand \index{Change}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
Use
\emph on
\begin_inset Quotes eld
\end_inset
cd
\begin_inset LatexCommand \index{cd}
\end_inset
..
\begin_inset Quotes erd
\end_inset
\emph default
to go up one directory.
\begin_inset LatexCommand \index{directory}
\end_inset
\begin_deeper
\layout Standard
\noindent
One dot
\begin_inset LatexCommand \index{dot}
\end_inset
'.' represents
\begin_inset LatexCommand \index{represents}
\end_inset
the current
\begin_inset LatexCommand \index{current}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
while two dots
\begin_inset LatexCommand \index{dots}
\end_inset
'..' represent
\begin_inset LatexCommand \index{represent}
\end_inset
the parent
\begin_inset LatexCommand \index{parent}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
\layout Standard
\noindent
\emph on
\begin_inset Quotes eld
\end_inset
cd
\begin_inset LatexCommand \index{cd}
\end_inset
-
\begin_inset Quotes erd
\end_inset
\emph default
will return
\begin_inset LatexCommand \index{return}
\end_inset
you to the previous
\begin_inset LatexCommand \index{previous}
\end_inset
directory (a bit
\begin_inset LatexCommand \index{bit}
\end_inset
like an
\begin_inset Quotes eld
\end_inset
undo
\begin_inset Quotes erd
\end_inset
).
\layout Standard
\noindent
You can also use
\emph on
cd absolute\SpecialChar ~
path
\emph default
or
\emph on
cd relative\SpecialChar ~
path
\emph default
(see below):
\layout Description
\noindent
Absolute\SpecialChar ~
paths
\begin_inset LatexCommand \index{paths}
\end_inset
An
\begin_inset Quotes eld
\end_inset
absolute
\begin_inset LatexCommand \index{absolute}
\end_inset
path
\begin_inset LatexCommand \index{path}
\end_inset
\begin_inset Quotes erd
\end_inset
is easily recognised
\begin_inset LatexCommand \index{recognised}
\end_inset
from the leading
\begin_inset LatexCommand \index{leading}
\end_inset
/.
The / means that you start
\begin_inset LatexCommand \index{start}
\end_inset
at the top
\begin_inset LatexCommand \index{top}
\end_inset
level directory
\begin_inset LatexCommand \index{directory}
\end_inset
and continue down.
\layout Standard
\noindent
For Example
\begin_inset LatexCommand \index{Example}
\end_inset
to get to /boot/grub
\emph on
\emph default
you would type:
\layout Code
\noindent
cd /boot/grub
\layout Standard
\noindent
This is an absolute
\begin_inset LatexCommand \index{absolute}
\end_inset
path
\begin_inset LatexCommand \index{path}
\end_inset
because you start
\begin_inset LatexCommand \index{start}
\end_inset
at the top
\begin_inset LatexCommand \index{top}
\end_inset
of the hierarchy
\begin_inset LatexCommand \index{hierarchy}
\end_inset
and go downwards
\begin_inset LatexCommand \index{downwards}
\end_inset
from there (it doesn't matter where in the filesystem
\begin_inset LatexCommand \index{filesystem}
\end_inset
you were when you typed the command).
\layout Description
\noindent
Relative\SpecialChar ~
paths
\begin_inset LatexCommand \index{paths}
\end_inset
A
\begin_inset Quotes eld
\end_inset
relative
\begin_inset LatexCommand \index{relative}
\end_inset
path
\begin_inset Quotes erd
\end_inset
doesn't have a preceding
\begin_inset LatexCommand \index{preceding}
\end_inset
slash.
Use a relative
\begin_inset LatexCommand \index{relative}
\end_inset
path when you start
\begin_inset LatexCommand \index{start}
\end_inset
from a directory
\begin_inset LatexCommand \index{directory}
\end_inset
below the top
\begin_inset LatexCommand \index{top}
\end_inset
level directory
\begin_inset LatexCommand \index{directory}
\end_inset
structure.
This is dependent
\begin_inset LatexCommand \index{dependent}
\end_inset
on where you are in the filesystem.
\begin_inset LatexCommand \index{filesystem}
\end_inset
\begin_deeper
\layout Standard
\noindent
For example
\begin_inset LatexCommand \index{example}
\end_inset
\emph on
\emph default
if you are in root's home
\begin_inset LatexCommand \index{home}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
and want to get to /root/music, you type:
\layout Code
\noindent
cd music
\end_deeper
\layout Standard
Please note that there is no / using the above
\emph on
cd
\begin_inset LatexCommand \index{cd}
\end_inset
\emph default
command.
Using a / would cause
\begin_inset LatexCommand \index{cause}
\end_inset
this to be an absolute
\begin_inset LatexCommand \index{absolute}
\end_inset
path,
\begin_inset LatexCommand \index{path}
\end_inset
working
\begin_inset LatexCommand \index{working}
\end_inset
from the top
\begin_inset LatexCommand \index{top}
\end_inset
of the hierarchy
\begin_inset LatexCommand \index{hierarchy}
\end_inset
downward.
\end_deeper
\layout Description
\noindent
ls
\begin_inset LatexCommand \index{ls}
\end_inset
List files
\begin_inset LatexCommand \index{files}
\end_inset
and directories.
\begin_inset LatexCommand \index{directories}
\end_inset
Typing
\begin_inset Quotes eld
\end_inset
ls
\begin_inset Quotes erd
\end_inset
will list
\begin_inset LatexCommand \index{list}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
and directories, but will not list
\begin_inset LatexCommand \index{list}
\end_inset
hidden
\begin_inset LatexCommand \index{hidden}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
or directories
\begin_inset LatexCommand \index{directories}
\end_inset
that start
\begin_inset LatexCommand \index{start}
\end_inset
with a leading
\begin_inset LatexCommand \index{leading}
\end_inset
'.'.
\begin_deeper
\layout Standard
\noindent
Example
\begin_inset LatexCommand \index{Example}
\end_inset
options:
\begin_inset LatexCommand \index{options}
\end_inset
\layout Itemize
\noindent
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-l
\emph default
--- long
\begin_inset LatexCommand \index{long}
\end_inset
style,
\begin_inset LatexCommand \index{style}
\end_inset
this lists
\begin_inset LatexCommand \index{lists}
\end_inset
permissions, file
\begin_inset LatexCommand \index{file}
\end_inset
size,
\begin_inset LatexCommand \index{size}
\end_inset
modification
\begin_inset LatexCommand \index{modification}
\end_inset
date,
\begin_inset LatexCommand \index{date}
\end_inset
ownership.
\begin_inset LatexCommand \index{ownership}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
not sure if its modification date or creation date\SpecialChar \ldots{}
\end_inset
\layout Itemize
\noindent
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-a
\emph default
--- this means "show all", this shows
\begin_inset LatexCommand \index{shows}
\end_inset
hidden
\begin_inset LatexCommand \index{hidden}
\end_inset
files,
\begin_inset LatexCommand \index{files}
\end_inset
by default
\begin_inset LatexCommand \index{default}
\end_inset
any file
\begin_inset LatexCommand \index{file}
\end_inset
or directory
\begin_inset LatexCommand \index{directory}
\end_inset
starting
\begin_inset LatexCommand \index{starting}
\end_inset
with a '.' will not be shown.
\begin_inset LatexCommand \index{shown}
\end_inset
\layout Itemize
\noindent
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-d
\emph default
--- list
\begin_inset LatexCommand \index{list}
\end_inset
directories
\begin_inset LatexCommand \index{directories}
\end_inset
only (see example
\begin_inset LatexCommand \index{example}
\end_inset
below)
\layout Itemize
\noindent
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-F
\emph default
--- append
\begin_inset LatexCommand \index{append}
\end_inset
symbols
\begin_inset LatexCommand \index{symbols}
\end_inset
to particular
\begin_inset LatexCommand \index{particular}
\end_inset
files,
\begin_inset LatexCommand \index{files}
\end_inset
such as * (asterisk) for executable
\begin_inset LatexCommand \index{executable}
\end_inset
files.
\begin_inset LatexCommand \index{files}
\end_inset
\layout Itemize
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-S
\emph default
--- sort
\begin_inset LatexCommand \index{sort}
\end_inset
the output
\begin_inset LatexCommand \index{output}
\end_inset
of the command
\begin_inset LatexCommand \index{command}
\end_inset
in decending
\begin_inset LatexCommand \index{decending}
\end_inset
order
\begin_inset LatexCommand \index{order}
\end_inset
sorted
\begin_inset LatexCommand \index{sorted}
\end_inset
by size.
\begin_inset LatexCommand \index{size}
\end_inset
\layout Itemize
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-R
\emph default
--- (recursive) to list
\begin_inset LatexCommand \index{list}
\end_inset
everything
\begin_inset LatexCommand \index{everything}
\end_inset
in the directories
\begin_inset LatexCommand \index{directories}
\end_inset
below as well as the current
\begin_inset LatexCommand \index{current}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax, either:
\layout Code
ls -options
\layout Standard
This simply lists
\begin_inset LatexCommand \index{lists}
\end_inset
everything in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory,
\begin_inset LatexCommand \index{directory}
\end_inset
the options
\begin_inset LatexCommand \index{options}
\end_inset
are not required
\begin_inset LatexCommand \index{required}
\end_inset
(options such as
\emph on
-l
\emph default
,
\emph on
-a
\emph default
et cetera).
\layout Code
ls -options string
\layout Standard
This lists
\begin_inset LatexCommand \index{lists}
\end_inset
files using a certain string.
\begin_inset LatexCommand \index{string}
\end_inset
The string
\begin_inset LatexCommand \index{string}
\end_inset
can contain standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
to list
\begin_inset LatexCommand \index{list}
\end_inset
multiple files,
\begin_inset LatexCommand \index{files}
\end_inset
to learn
\begin_inset LatexCommand \index{learn}
\end_inset
more
\begin_inset LatexCommand \index{more}
\end_inset
about standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
please read
\begin_inset LatexCommand \index{read}
\end_inset
\begin_inset LatexCommand \ref{standard-wildcards}
\end_inset
\layout Standard
\noindent
You can use
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-d
\emph default
to show
\begin_inset LatexCommand \index{show}
\end_inset
directories that match
\begin_inset LatexCommand \index{match}
\end_inset
an exact
\begin_inset LatexCommand \index{exact}
\end_inset
string, or use standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards.
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
Type
\begin_inset Quotes eld
\end_inset
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-d */
\begin_inset Quotes erd
\end_inset
to list
\begin_inset LatexCommand \index{list}
\end_inset
all subdirectories
\begin_inset LatexCommand \index{subdirectories}
\end_inset
of the current
\begin_inset LatexCommand \index{current}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
Depending
\begin_inset LatexCommand \index{Depending}
\end_inset
on the setup
\begin_inset LatexCommand \index{setup}
\end_inset
of your aliases
\begin_inset LatexCommand \index{aliases}
\end_inset
(see
\begin_inset LatexCommand \ref{Shell-Tips}
\end_inset
) you may simply be able
\begin_inset LatexCommand \index{able}
\end_inset
to type
\emph on
lsd
\begin_inset LatexCommand \index{lsd}
\end_inset
\emph default
as the equivalent
\begin_inset LatexCommand \index{equivalent}
\end_inset
to
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-d */
\emph default
.
\layout Standard
\noindent
Examples
\begin_inset LatexCommand \index{Examples}
\end_inset
for
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-d
\emph default
:
\layout Code
\noindent
ls -d
\emph on
\emph default
*/
\layout Standard
Lists
\begin_inset LatexCommand \index{Lists}
\end_inset
all subdirectories
\begin_inset LatexCommand \index{subdirectories}
\end_inset
of current
\begin_inset LatexCommand \index{current}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
\layout Code
ls -d string*
\layout Standard
Lists
\begin_inset LatexCommand \index{Lists}
\end_inset
directories that start
\begin_inset LatexCommand \index{start}
\end_inset
with "string"
\begin_inset LatexCommand \index{string}
\end_inset
.
\layout Code
ls -d /usr/*/*/doc
\layout Standard
Lists
\begin_inset LatexCommand \index{Lists}
\end_inset
all directories
\begin_inset LatexCommand \index{directories}
\end_inset
that are two levels
\begin_inset LatexCommand \index{levels}
\end_inset
below the /usr/ directory
\begin_inset LatexCommand \index{directory}
\end_inset
and have a directory
\begin_inset LatexCommand \index{directory}
\end_inset
called
\begin_inset Quotes eld
\end_inset
doc
\begin_inset Quotes erd
\end_inset
, this trick
\begin_inset LatexCommand \index{trick}
\end_inset
can come in quite
\begin_inset LatexCommand \index{quite}
\end_inset
handy sometimes.
\layout SGML
\layout SGML
You can also use
\layout SGML
\layout SGML
Depending on how your aliases (see
\begin_inset LatexCommand \ref{Shell-Tips}
\end_inset
) are setup you can also use
\emph on
l
\emph default
,
\emph on
la
\emph default
(list all) and
\emph on
ll
\emph default
(list long) to perform the above commands
\layout SGML
\layout SGML
\end_deeper
\layout Description
pwd
\begin_inset LatexCommand \index{pwd}
\end_inset
Print
\begin_inset LatexCommand \index{Print}
\end_inset
working
\begin_inset LatexCommand \index{working}
\end_inset
directory.
Print
\begin_inset LatexCommand \index{Print}
\end_inset
the absolute
\begin_inset LatexCommand \index{absolute}
\end_inset
(complete) path
\begin_inset LatexCommand \index{path}
\end_inset
to the directory
\begin_inset LatexCommand \index{directory}
\end_inset
the user
\begin_inset LatexCommand \index{user}
\end_inset
is currently in.
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
pwd
\layout Standard
This will tell
\begin_inset LatexCommand \index{tell}
\end_inset
you the full
\begin_inset LatexCommand \index{full}
\end_inset
path
\begin_inset LatexCommand \index{path}
\end_inset
to what directory
\begin_inset LatexCommand \index{directory}
\end_inset
you are in, for example
\begin_inset LatexCommand \index{example}
\end_inset
it may output
\begin_inset LatexCommand \index{output}
\end_inset
\begin_inset Quotes eld
\end_inset
/usr/local/bin
\begin_inset Quotes erd
\end_inset
if you are currently in that directory.
\begin_inset LatexCommand \index{directory}
\end_inset
\end_deeper
\layout Description
\noindent
tree Outputs
\begin_inset LatexCommand \index{Outputs}
\end_inset
an ASCII
\begin_inset LatexCommand \index{ASCII}
\end_inset
text tree
\begin_inset LatexCommand \index{tree}
\end_inset
graph
\begin_inset LatexCommand \index{graph}
\end_inset
starting
\begin_inset LatexCommand \index{starting}
\end_inset
at a given directory
\begin_inset LatexCommand \index{directory}
\end_inset
(by default
\begin_inset LatexCommand \index{default}
\end_inset
the current
\begin_inset LatexCommand \index{current}
\end_inset
directory).
This command
\begin_inset LatexCommand \index{command}
\end_inset
recursively lists
\begin_inset LatexCommand \index{lists}
\end_inset
all files
\begin_inset LatexCommand \index{files}
\end_inset
and all directories.
\begin_inset LatexCommand \index{directories}
\end_inset
\begin_deeper
\layout Standard
\noindent
In other words,
\begin_inset LatexCommand \index{words}
\end_inset
it will list
\begin_inset LatexCommand \index{list}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
within the directories
\begin_inset LatexCommand \index{directories}
\end_inset
below the current
\begin_inset LatexCommand \index{current}
\end_inset
one, as well as all files
\begin_inset LatexCommand \index{files}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
\layout Standard
\noindent
\emph on
tree
\emph default
has a large number
\begin_inset LatexCommand \index{number}
\end_inset
of options,
\begin_inset LatexCommand \index{options}
\end_inset
refer
\begin_inset LatexCommand \index{refer}
\end_inset
to the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
for details.
\begin_inset LatexCommand \index{details}
\end_inset
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
tree
\layout Standard
or
\layout Code
tree -option(s) /optional/directory/to/list
\end_deeper
\layout Subsection
Finding files
\begin_inset LatexCommand \label{finding-files}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
AFAIK
\emph on
find
\emph default
is the only tool necessary on *nix to find files/directories (excluding
which, whereis, slocate).
Do others exist? (I don't think they're necessary)
\end_inset
\layout Description
find
\begin_inset LatexCommand \index{find}
\end_inset
\emph on
find
\emph default
is a tool
\begin_inset LatexCommand \index{tool}
\end_inset
which looks
\begin_inset LatexCommand \index{looks}
\end_inset
for files
\begin_inset LatexCommand \index{files}
\end_inset
on a filesystem.
\begin_inset LatexCommand \index{filesystem}
\end_inset
\emph on
find
\emph default
has a large number
\begin_inset LatexCommand \index{number}
\end_inset
of options
\begin_inset LatexCommand \index{options}
\end_inset
which can be used to customise
\begin_inset LatexCommand \index{customise}
\end_inset
the search
\begin_inset LatexCommand \index{search}
\end_inset
(refer to the manual/info pages).
\begin_deeper
\layout Standard
\noindent
Note that find
\begin_inset LatexCommand \index{find}
\end_inset
works
\begin_inset LatexCommand \index{works}
\end_inset
with standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards,
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
\begin_inset LatexCommand \ref{standard-wildcards}
\end_inset
, and can work
\begin_inset LatexCommand \index{work}
\end_inset
with regular
\begin_inset LatexCommand \index{regular}
\end_inset
expressions,
\begin_inset LatexCommand \ref{regular-expressions}
\end_inset
.
\layout Standard
\noindent
Basic
\begin_inset LatexCommand \index{Basic}
\end_inset
example:
\layout Code
finsd / -name file
\layout Standard
This would look
\begin_inset LatexCommand \index{look}
\end_inset
for a file
\begin_inset LatexCommand \index{file}
\end_inset
named
\begin_inset LatexCommand \index{named}
\end_inset
\begin_inset Quotes eld
\end_inset
file
\begin_inset Quotes erd
\end_inset
and start
\begin_inset LatexCommand \index{start}
\end_inset
at the root
\begin_inset LatexCommand \index{root}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
(it will search
\begin_inset LatexCommand \index{search}
\end_inset
all directories
\begin_inset LatexCommand \index{directories}
\end_inset
including
\begin_inset LatexCommand \index{including}
\end_inset
those that are mounted
\begin_inset LatexCommand \index{mounted}
\end_inset
filesystems).
\layout Standard
\noindent
The
\emph on
`-name'
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
is case sensitive
\begin_inset LatexCommand \index{sensitive}
\end_inset
you can use the
\emph on
`-iname'
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to find
\begin_inset LatexCommand \index{find}
\end_inset
something regardless
\begin_inset LatexCommand \index{regardless}
\end_inset
of case.
\layout Standard
Use the
\emph on
'-regex'
\emph default
and
\emph on
'-iregex'
\emph default
to find
\begin_inset LatexCommand \index{find}
\end_inset
something according to a regular
\begin_inset LatexCommand \index{regular}
\end_inset
expression (either case sensitive
\begin_inset LatexCommand \index{sensitive}
\end_inset
or case insensitive
\begin_inset LatexCommand \index{insensitive}
\end_inset
respectively).
\layout Standard
The
\emph on
'-exec'
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
is one of the more
\begin_inset LatexCommand \index{more}
\end_inset
advanced
\begin_inset LatexCommand \index{advanced}
\end_inset
find
\begin_inset LatexCommand \index{find}
\end_inset
operations.
\begin_inset LatexCommand \index{operations}
\end_inset
It executes a command
\begin_inset LatexCommand \index{command}
\end_inset
on the files
\begin_inset LatexCommand \index{files}
\end_inset
it finds
\begin_inset LatexCommand \index{finds}
\end_inset
(such as moving
\begin_inset LatexCommand \index{moving}
\end_inset
or removing
\begin_inset LatexCommand \index{removing}
\end_inset
it or anything else\SpecialChar \ldots{}
).
\layout Standard
To use the
\emph on
-exec
\emph default
option:
\begin_inset LatexCommand \index{option}
\end_inset
use find
\begin_inset LatexCommand \index{find}
\end_inset
to find
\begin_inset LatexCommand \index{find}
\end_inset
something, then add
\begin_inset LatexCommand \index{add}
\end_inset
the
\emph on
-exec
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to the end,
\begin_inset LatexCommand \index{end}
\end_inset
then:
\layout SGML
\layout SGML
command_to_be_executed then '{}'
\emph on
\emph default
(curly brackets) then the arguments (for example a new
directory) and finally a ';' .
\layout SGML
\layout Standard
See below for an example
\begin_inset LatexCommand \index{example}
\end_inset
of use this command.
\begin_inset LatexCommand \index{command}
\end_inset
\layout SGML
\layout SGML
\layout SGML
\layout SGML
This is the tool you want to execute on the files find locates.
For example if you wanted to remove everything it finds then you would
use
\emph on
-exec rm -f
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
The curly brackets are used in find to represent the current file
which has been found.
ie.
If it found the file shopping.doc then {} would be substituted with shopping.doc.
It would then continue to substitute {} for each file it finds.
The brackets are normally protected by backslashes (\) or single-quotation
marks ('), to stop bash expanding them (trying to interpret them as a special
command eg.
a wildcard).
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
This is the symbol used by find to signal the end of the commands.
It's usually protected by a backslash (\) or quotes to stop bash from
trying to expand it.
\layout SGML
\layout SGML
\layout SGML
\layout Code
find / -name '*.doc' -exec cp '{}' /tmp/ ';'
\layout Standard
The above command
\begin_inset LatexCommand \index{command}
\end_inset
would find
\begin_inset LatexCommand \index{find}
\end_inset
any files
\begin_inset LatexCommand \index{files}
\end_inset
with the extension
\begin_inset LatexCommand \index{extension}
\end_inset
'.doc' and copy
\begin_inset LatexCommand \index{copy}
\end_inset
them to your /tmp directory,
\begin_inset LatexCommand \index{directory}
\end_inset
obviously this command
\begin_inset LatexCommand \index{command}
\end_inset
is quite
\begin_inset LatexCommand \index{quite}
\end_inset
useless, it's just an example
\begin_inset LatexCommand \index{example}
\end_inset
of what find
\begin_inset LatexCommand \index{find}
\end_inset
can do.
Note that the quotation
\begin_inset LatexCommand \index{quotation}
\end_inset
marks are there to stop
\begin_inset LatexCommand \index{stop}
\end_inset
bash
\begin_inset LatexCommand \index{bash}
\end_inset
from trying
\begin_inset LatexCommand \index{trying}
\end_inset
to interpret
\begin_inset LatexCommand \index{interpret}
\end_inset
the other characters
\begin_inset LatexCommand \index{characters}
\end_inset
as something.
\layout Standard
Excluding
\begin_inset LatexCommand \index{Excluding}
\end_inset
particular folders
\begin_inset LatexCommand \index{folders}
\end_inset
with
\emph on
find
\emph default
can be quite
\begin_inset LatexCommand \index{quite}
\end_inset
confusing, but it may be necessary if you want to search
\begin_inset LatexCommand \index{search}
\end_inset
your main disk
\begin_inset LatexCommand \index{disk}
\end_inset
(without searching
\begin_inset LatexCommand \index{searching}
\end_inset
every mounted
\begin_inset LatexCommand \index{mounted}
\end_inset
filesystem).
Use the
\emph on
-path
\begin_inset LatexCommand \index{-path}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to exclude
\begin_inset LatexCommand \index{exclude}
\end_inset
the particular
\begin_inset LatexCommand \index{particular}
\end_inset
folder (note cannot have a '/' (forward slash) on the end) and the
\emph on
-prune
\begin_inset LatexCommand \index{-prune}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to exclude
\begin_inset LatexCommand \index{exclude}
\end_inset
the subdirectories.
\begin_inset LatexCommand \index{subdirectories}
\end_inset
An example
\begin_inset LatexCommand \index{example}
\end_inset
is below:
\layout Code
find / -path '/mnt/win_c' -prune -o -name "string" -print
\layout Standard
This example
\begin_inset LatexCommand \index{example}
\end_inset
will search
\begin_inset LatexCommand \index{search}
\end_inset
your entire
\begin_inset LatexCommand \index{entire}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
tree (everything that is mounted
\begin_inset LatexCommand \index{mounted}
\end_inset
under it) excluding
\begin_inset LatexCommand \index{excluding}
\end_inset
/mnt/win_c and all of the subdirectories
\begin_inset LatexCommand \index{subdirectories}
\end_inset
under /mnt/win_c.
When using the
\emph on
-path
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
you can use wildcards.
\begin_inset LatexCommand \index{wildcards}
\end_inset
\layout Standard
Note that you could add
\begin_inset LatexCommand \index{add}
\end_inset
more
\emph on
-path
\begin_inset LatexCommand \index{-path}
\end_inset
'/directory'
\emph default
statements
\begin_inset LatexCommand \index{statements}
\end_inset
on if you wanted.
\layout Standard
Find
\begin_inset LatexCommand \index{Find}
\end_inset
has many, many different
\begin_inset LatexCommand \index{different}
\end_inset
options,
\begin_inset LatexCommand \index{options}
\end_inset
refer
\begin_inset LatexCommand \index{refer}
\end_inset
to the manual
\begin_inset LatexCommand \index{manual}
\end_inset
(and info) page
\begin_inset LatexCommand \index{page}
\end_inset
for more
\begin_inset LatexCommand \index{more}
\end_inset
details.
\begin_inset LatexCommand \index{details}
\end_inset
\end_deeper
\layout Description
slocate
\begin_inset LatexCommand \index{slocate}
\end_inset
\emph on
slocate
\emph default
outputs
\begin_inset LatexCommand \index{outputs}
\end_inset
a list
\begin_inset LatexCommand \index{list}
\end_inset
of all files
\begin_inset LatexCommand \index{files}
\end_inset
on the system
\begin_inset LatexCommand \index{system}
\end_inset
that match
\begin_inset LatexCommand \index{match}
\end_inset
the pattern,
\begin_inset LatexCommand \index{pattern}
\end_inset
giving their full
\begin_inset LatexCommand \index{full}
\end_inset
path
\begin_inset LatexCommand \index{path}
\end_inset
name (it doesn't have to be an exact
\begin_inset LatexCommand \index{exact}
\end_inset
match, anything which
\begin_inset LatexCommand \index{which}
\end_inset
contains the word
\begin_inset LatexCommand \index{word}
\end_inset
is shown).
\begin_deeper
\layout SGML
\layout SGML
Replaces
\emph on
locate
\emph default
\layout SGML
Secure locate is a replacement for
\emph on
locate
\emph default
, both have identical syntax.
On most distributions locate is an alias to
\emph on
slocate
\emph default
.
\layout SGML
\layout Standard
\noindent
Commmand
\begin_inset LatexCommand \index{Commmand}
\end_inset
syntax:
\begin_inset LatexCommand \index{syntax}
\end_inset
\layout Code
slocate string
\layout SGML
\layout SGML
This won't work unless
\layout SGML
\layout SGML
You need to run either
\emph on
updatedb
\emph default
(as root) or
\emph on
slocate -u
\emph default
(as root) for slocate to work.
\layout SGML
\layout SGML
\end_deeper
\layout Description
whereis
\emph on
whereis
\begin_inset LatexCommand \index{whereis}
\end_inset
\emph default
locates
\begin_inset LatexCommand \index{locates}
\end_inset
where the binary,
\begin_inset LatexCommand \index{binary}
\end_inset
source,
\begin_inset LatexCommand \index{source}
\end_inset
and manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
is for a particular
\begin_inset LatexCommand \index{particular}
\end_inset
program, it uses exact
\begin_inset LatexCommand \index{exact}
\end_inset
matches only, if you only know part
\begin_inset LatexCommand \index{part}
\end_inset
of the name use
\emph on
slocate
\emph default
.
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
\noindent
whereis program_name
\end_deeper
\layout Description
\noindent
which
\begin_inset LatexCommand \index{which}
\end_inset
Virtually
\begin_inset LatexCommand \index{Virtually}
\end_inset
the same as whereis,
\begin_inset LatexCommand \index{whereis}
\end_inset
except it only finds
\begin_inset LatexCommand \index{finds}
\end_inset
the executable
\begin_inset LatexCommand \index{executable}
\end_inset
(the physical
\begin_inset LatexCommand \index{physical}
\end_inset
program).
It only looks
\begin_inset LatexCommand \index{looks}
\end_inset
in the PATH
\begin_inset LatexCommand \index{PATH}
\end_inset
(environment variable) of a users
\begin_inset LatexCommand \index{users}
\end_inset
shell.
\begin_inset LatexCommand \index{shell}
\end_inset
\begin_deeper
\layout Standard
\noindent
Use the
\emph on
-a
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to list
\begin_inset LatexCommand \index{list}
\end_inset
all occurances
\begin_inset LatexCommand \index{occurances}
\end_inset
of the particular
\begin_inset LatexCommand \index{particular}
\end_inset
program_name
\begin_inset LatexCommand \index{program_name}
\end_inset
in your path
\begin_inset LatexCommand \index{path}
\end_inset
(so if theres more
\begin_inset LatexCommand \index{more}
\end_inset
than one you can see it).
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
which program_name
\end_deeper
\layout Section
Working with files and folders
\begin_inset LatexCommand \label{working-files-folders}
\end_inset
\layout Description
\noindent
mkdir
\begin_inset LatexCommand \index{mkdir}
\end_inset
Make a directory.
\begin_inset LatexCommand \index{directory}
\end_inset
Use
\emph on
mkdir
\begin_inset LatexCommand \index{mkdir}
\end_inset
-p
\emph default
to create subdirectories
\begin_inset LatexCommand \index{subdirectories}
\end_inset
automatically.
\begin_inset LatexCommand \index{automatically}
\end_inset
\begin_deeper
\layout SGML
\noindent
\layout SGML
\noindent
Directories are Folders
\layout SGML
\noindent
Directories are sometimes called folders in other operating systems
(such as Microsoft Windows)
\layout SGML
\noindent
\layout Standard
\noindent
Examples:
\layout Code
mkdir -p /home/matt/work/maths
\layout Standard
This would create the directories
\begin_inset LatexCommand \index{directories}
\end_inset
\begin_inset Quotes eld
\end_inset
work
\begin_inset Quotes erd
\end_inset
and
\begin_inset Quotes eld
\end_inset
maths
\begin_inset Quotes erd
\end_inset
under matt's home
\begin_inset LatexCommand \index{home}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
(if matt's home
\begin_inset LatexCommand \index{home}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
didn't exist
\begin_inset LatexCommand \index{exist}
\end_inset
it would create that too).
\layout Code
mkdir foo
\layout Standard
This would create a directory
\begin_inset LatexCommand \index{directory}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
path
\begin_inset LatexCommand \index{path}
\end_inset
named
\begin_inset Quotes eld
\end_inset
foo
\begin_inset Quotes erd
\end_inset
.
\end_deeper
\layout Description
\noindent
rm
\begin_inset LatexCommand \index{rm}
\end_inset
Remove/delete a file(s) or directories(s).
You can use standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
with this command
\begin_inset LatexCommand \index{command}
\end_inset
\begin_inset LatexCommand \ref{standard-wildcards}
\end_inset
.
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
rm -options file_or_folder
\layout Standard
You can of course use standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
to delete
\begin_inset LatexCommand \index{delete}
\end_inset
multiple files
\begin_inset LatexCommand \index{files}
\end_inset
or multiple
\begin_inset LatexCommand \index{multiple}
\end_inset
directories
\begin_inset LatexCommand \index{directories}
\end_inset
and files.
\begin_inset LatexCommand \index{files}
\end_inset
\layout Standard
Use the
\emph on
-R
\begin_inset LatexCommand \index{-R}
\end_inset
\emph default
or
\emph on
-r
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to remove
\begin_inset LatexCommand \index{remove}
\end_inset
recursively, this removes
\begin_inset LatexCommand \index{removes}
\end_inset
everything
\begin_inset LatexCommand \index{everything}
\end_inset
within subdirectories.
\begin_inset LatexCommand \index{subdirectories}
\end_inset
Also try
\begin_inset LatexCommand \index{try}
\end_inset
the
\emph on
-f
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to force
\begin_inset LatexCommand \index{force}
\end_inset
removal (useful when you don't want to be prompted).
\layout Standard
\noindent
To remove
\begin_inset LatexCommand \index{remove}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
with special
\begin_inset LatexCommand \index{special}
\end_inset
characters, for example,
\begin_inset LatexCommand \index{example}
\end_inset
\begin_inset Quotes eld
\end_inset
da*d
\begin_inset Quotes erd
\end_inset
type:
\layout Code
\noindent
rm -- da*d
\layout Standard
\noindent
After the
\begin_inset Quotes eld
\end_inset
--
\begin_inset Quotes erd
\end_inset
it uses everything
\begin_inset LatexCommand \index{everything}
\end_inset
literally instead of using them as standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards.
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
This may be useful when you need to delete
\begin_inset LatexCommand \index{delete}
\end_inset
a filename
\begin_inset LatexCommand \index{filename}
\end_inset
containing weird
\begin_inset LatexCommand \index{weird}
\end_inset
symbols (this also works on other tools\SpecialChar \ldots{}
).
\layout SGML
\noindent
\layout SGML
Disabling Aliases (per execution)
\layout SGML
\layout SGML
On some systems such as Mandrake an alias will send
\emph on
rm
\emph default
to
\emph on
rm -i
\emph default
(prompting you for every file you wish to delete).
To override this use:
\emph on
\backslash
rm -R directory
\emph default
(using the
\backslash
disables the alias for this run only)
\layout SGML
\layout SGML
\layout SGML
\begin_inset Note
collapsed false
\layout Standard
does red-hat and other distro's do this?\SpecialChar \ldots{}
I'm not a redhat user, or debian\SpecialChar \ldots{}
\end_inset
\end_deeper
\layout Description
\noindent
rmdir
\begin_inset LatexCommand \index{rmdir}
\end_inset
Remove an empty
\begin_inset LatexCommand \index{empty}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
If you want to remove
\begin_inset LatexCommand \index{remove}
\end_inset
a directory
\begin_inset LatexCommand \index{directory}
\end_inset
with files
\begin_inset LatexCommand \index{files}
\end_inset
in it type
\begin_inset Quotes eld
\end_inset
rm
\begin_inset LatexCommand \index{rm}
\end_inset
-R
\begin_inset LatexCommand \index{-R}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
\begin_inset Quotes erd
\end_inset
,
\emph on
\emph default
read
\begin_inset LatexCommand \index{read}
\end_inset
above for information
\begin_inset LatexCommand \index{information}
\end_inset
on
\emph on
rm
\begin_inset LatexCommand \index{rm}
\end_inset
-R
\begin_inset LatexCommand \index{-R}
\end_inset
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
rmdir directory
\layout Standard
This will only remove
\begin_inset LatexCommand \index{remove}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
if it's empty
\begin_inset LatexCommand \index{empty}
\end_inset
otherwise it will exit
\begin_inset LatexCommand \index{exit}
\end_inset
with an error
\begin_inset LatexCommand \index{error}
\end_inset
message.
\end_deeper
\layout Description
\noindent
mv
\begin_inset LatexCommand \index{mv}
\end_inset
Move a file
\begin_inset LatexCommand \index{file}
\end_inset
or a directory
\begin_inset LatexCommand \index{directory}
\end_inset
to a new
\begin_inset LatexCommand \index{new}
\end_inset
location or rename
\begin_inset LatexCommand \index{rename}
\end_inset
a file/directory.
\begin_deeper
\layout Standard
\noindent
Rename
\begin_inset LatexCommand \index{Rename}
\end_inset
example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
\noindent
mv filename1 filename2
\layout Standard
Renames
\begin_inset LatexCommand \index{Renames}
\end_inset
filename1
\begin_inset LatexCommand \index{filename1}
\end_inset
to filename2.
\begin_inset LatexCommand \index{filename2}
\end_inset
\layout Standard
\noindent
To move
\begin_inset LatexCommand \index{move}
\end_inset
a file
\begin_inset LatexCommand \index{file}
\end_inset
or directory,
\begin_inset LatexCommand \index{directory}
\end_inset
simply type:
\layout Code
\noindent
mv original_file_or_folder new_location
\layout Standard
Note that this command
\begin_inset LatexCommand \index{command}
\end_inset
can use standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
\begin_inset LatexCommand \ref{standard-wildcards}
\end_inset
to move
\begin_inset LatexCommand \index{move}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
(not for renaming).
\layout SGML
\layout SGML
Move and rename
\layout SGML
\layout SGML
Note that you can also move and rename a file in a single command.
The difference is with the destination (right hand side) you change the
filename to the new name of the file.
\layout SGML
\layout SGML
For example typing:
\layout SGML
\layout SGML
This would move the file "configuration.txt" to /home/joe/
and rename it "backupconfig"
\layout SGML
\end_deeper
\layout Description
\noindent
cp
\begin_inset LatexCommand \index{cp}
\end_inset
Copy
\begin_inset LatexCommand \index{Copy}
\end_inset
a file.
\begin_inset LatexCommand \index{file}
\end_inset
Has a number
\begin_inset LatexCommand \index{number}
\end_inset
of useful options,
\begin_inset LatexCommand \index{options}
\end_inset
such as
\emph on
-R
\begin_inset LatexCommand \index{-R}
\end_inset
\emph default
(or
\emph on
-r
\emph default
) which
\begin_inset LatexCommand \index{which}
\end_inset
recursively
\begin_inset LatexCommand \index{recursively}
\end_inset
copies
\begin_inset LatexCommand \index{copies}
\end_inset
directories and subdirectories.
\begin_inset LatexCommand \index{subdirectories}
\end_inset
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
cp -options file_or_files new_location
\layout Standard
\noindent
Examples:
\layout Code
\noindent
cp file1 file2
\layout Standard
Simply copy
\begin_inset LatexCommand \index{copy}
\end_inset
file1
\begin_inset LatexCommand \index{file1}
\end_inset
to file2
\begin_inset LatexCommand \index{file2}
\end_inset
(in the same directory).
\layout Code
\noindent
cp /tmp/file1 ~/file2 /mnt/win_c
\layout Standard
\noindent
Where the last
\begin_inset LatexCommand \index{last}
\end_inset
option is the directory
\begin_inset LatexCommand \index{directory}
\end_inset
to be copy
\begin_inset LatexCommand \index{copy}
\end_inset
to.
Copies
\begin_inset LatexCommand \index{Copies}
\end_inset
two files
\begin_inset LatexCommand \index{files}
\end_inset
from different
\begin_inset LatexCommand \index{different}
\end_inset
areas
\begin_inset LatexCommand \index{areas}
\end_inset
of the hard disk
\begin_inset LatexCommand \index{disk}
\end_inset
to /mnt/win_c
\layout Code
\noindent
cp -R directory_and_or_files new_location
\layout Standard
\noindent
This command
\begin_inset LatexCommand \index{command}
\end_inset
will copy
\begin_inset LatexCommand \index{copy}
\end_inset
directories (and all subdirectories) and/or files
\begin_inset LatexCommand \index{files}
\end_inset
t
\emph on
o new_location
\begin_inset LatexCommand \index{new_location}
\end_inset
\emph default
\begin_inset Note
collapsed false
\layout Standard
and from core-untiles 5.0 cp -r is ok.
and -r is equivalent to -R in most other commands too
\end_inset
\layout Standard
Note that this command
\begin_inset LatexCommand \index{command}
\end_inset
can use standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
\begin_inset LatexCommand \ref{standard-wildcards}
\end_inset
to copy
\begin_inset LatexCommand \index{copy}
\end_inset
multiple files.
\begin_inset LatexCommand \index{files}
\end_inset
\layout Standard
You may also like to try
\begin_inset LatexCommand \index{try}
\end_inset
the
\begin_inset Quotes eld
\end_inset
-u
\begin_inset Quotes erd
\end_inset
when moving
\begin_inset LatexCommand \index{moving}
\end_inset
large directories
\begin_inset LatexCommand \index{directories}
\end_inset
around, this copies
\begin_inset LatexCommand \index{copies}
\end_inset
only if the source
\begin_inset LatexCommand \index{source}
\end_inset
file is newer
\begin_inset LatexCommand \index{newer}
\end_inset
than the destination
\begin_inset LatexCommand \index{destination}
\end_inset
to where you are copying
\begin_inset LatexCommand \index{copying}
\end_inset
to, or if the destination file
\begin_inset LatexCommand \index{file}
\end_inset
does not exist
\begin_inset LatexCommand \index{exist}
\end_inset
at all.
\end_deeper
\layout Description
ln
\begin_inset LatexCommand \index{ln}
\end_inset
Create a link
\begin_inset LatexCommand \index{link}
\end_inset
to a file.
\begin_inset LatexCommand \index{file}
\end_inset
There are two types
\begin_inset LatexCommand \index{types}
\end_inset
of links:
\begin_inset LatexCommand \index{links}
\end_inset
\begin_deeper
\layout Description
\series bold
Hard\SpecialChar ~
links
\series default
Hard
\begin_inset LatexCommand \index{Hard}
\end_inset
links
\begin_inset LatexCommand \index{links, hard}
\end_inset
are considered pointers
\begin_inset LatexCommand \index{pointers}
\end_inset
to a file
\begin_inset LatexCommand \index{file}
\end_inset
(the number
\begin_inset LatexCommand \index{number}
\end_inset
is listed
\begin_inset LatexCommand \index{listed}
\end_inset
by typing
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-l
\emph default
).
Each hard-link
\begin_inset LatexCommand \index{hard-link}
\end_inset
is a reference
\begin_inset LatexCommand \index{reference}
\end_inset
to a file.
\begin_inset LatexCommand \index{file}
\end_inset
\begin_deeper
\layout Standard
The file
\begin_inset LatexCommand \index{file}
\end_inset
itself only goes away when all hard-links
\begin_inset LatexCommand \index{hard-links}
\end_inset
are deleted.
\begin_inset LatexCommand \index{deleted}
\end_inset
If you delete
\begin_inset LatexCommand \index{delete}
\end_inset
the original
\begin_inset LatexCommand \index{original}
\end_inset
file and there are hard links
\begin_inset LatexCommand \index{links}
\end_inset
to it the original file
\begin_inset LatexCommand \index{file}
\end_inset
will remain.
\layout Standard
Example:
\layout Code
ln target_name link_name
\layout Standard
Will create a
\begin_inset Quotes eld
\end_inset
hard link
\begin_inset LatexCommand \index{link}
\end_inset
\begin_inset Quotes erd
\end_inset
to target_name
\begin_inset LatexCommand \index{target_name}
\end_inset
called link_name,
\begin_inset LatexCommand \index{link_name}
\end_inset
you need to delete
\begin_inset LatexCommand \index{delete}
\end_inset
both of these to remove
\begin_inset LatexCommand \index{remove}
\end_inset
the file.
\begin_inset LatexCommand \index{file}
\end_inset
\end_deeper
\layout Description
\series bold
Symbolic
\series default
\SpecialChar ~
\series bold
links
\series default
Symbolic
\begin_inset LatexCommand \index{Symbolic}
\end_inset
links
\begin_inset LatexCommand \index{links, symbolic}
\end_inset
are created by typing
\begin_inset Quotes eld
\end_inset
ln
\begin_inset LatexCommand \index{ln}
\end_inset
-s
\begin_inset Quotes erd
\end_inset
.
\emph on
\emph default
When you remove
\begin_inset LatexCommand \index{remove}
\end_inset
the original
\begin_inset LatexCommand \index{original}
\end_inset
file the symbolic
\begin_inset LatexCommand \index{symbolic}
\end_inset
link
\begin_inset LatexCommand \index{link}
\end_inset
\begin_inset LatexCommand \index{symbolic link}
\end_inset
becomes broken,
\begin_inset LatexCommand \index{broken}
\end_inset
a symbolic link
\begin_inset LatexCommand \index{link}
\end_inset
is similar
\begin_inset LatexCommand \index{similar}
\end_inset
to a windows
\begin_inset LatexCommand \index{windows}
\end_inset
\begin_inset Quotes eld
\end_inset
short-cut
\begin_inset Quotes erd
\end_inset
.
\begin_deeper
\layout Standard
The advantage
\begin_inset LatexCommand \index{advantage}
\end_inset
of symbolic
\begin_inset LatexCommand \index{symbolic}
\end_inset
links is that they can be to something on another file-system, while hard-links
\begin_inset LatexCommand \index{hard-links}
\end_inset
can only exist
\begin_inset LatexCommand \index{exist}
\end_inset
on the same file-system.
\begin_inset LatexCommand \index{file-system}
\end_inset
\layout Standard
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
ln -s target_name link_name
\layout Standard
This creates a symbolic
\begin_inset LatexCommand \index{symbolic}
\end_inset
link
\begin_inset LatexCommand \index{link}
\end_inset
\begin_inset LatexCommand \index{symbolic link}
\end_inset
to
\begin_inset Quotes eld
\end_inset
target_name
\begin_inset Quotes erd
\end_inset
called
\begin_inset Quotes eld
\end_inset
link_name
\begin_inset Quotes erd
\end_inset
, if you delete
\begin_inset LatexCommand \index{delete}
\end_inset
the original
\begin_inset LatexCommand \index{original}
\end_inset
file the symbolic
\begin_inset LatexCommand \index{symbolic}
\end_inset
link
\begin_inset LatexCommand \index{link}
\end_inset
\begin_inset LatexCommand \index{symbolic link}
\end_inset
won't work
\begin_inset LatexCommand \index{work}
\end_inset
(it becomes a broken
\begin_inset LatexCommand \index{broken}
\end_inset
link).
\end_deeper
\end_deeper
\layout Description
shred
\begin_inset LatexCommand \index{shred}
\end_inset
Securely remove
\begin_inset LatexCommand \index{remove}
\end_inset
a file
\begin_inset LatexCommand \index{file}
\end_inset
by overwriting
\begin_inset LatexCommand \index{overwriting}
\end_inset
it first.
Prevents
\begin_inset LatexCommand \index{Prevents}
\end_inset
the data
\begin_inset LatexCommand \index{data}
\end_inset
from being recovered
\begin_inset LatexCommand \index{recovered}
\end_inset
by software
\begin_inset LatexCommand \index{software}
\end_inset
(and even
\begin_inset LatexCommand \index{even}
\end_inset
by most hardware), please be very careful
\begin_inset LatexCommand \index{careful}
\end_inset
when using shred
\begin_inset LatexCommand \index{shred}
\end_inset
as you may never be able
\begin_inset LatexCommand \index{able}
\end_inset
to retrieve
\begin_inset LatexCommand \index{retrieve}
\end_inset
the data
\begin_inset LatexCommand \index{data}
\end_inset
you have run
\begin_inset LatexCommand \index{run}
\end_inset
the application
\begin_inset LatexCommand \index{application}
\end_inset
on.
\begin_deeper
\layout Standard
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
shred -n 2 -z -v /dev/hda1
\layout Quotation
What this tells
\begin_inset LatexCommand \index{tells}
\end_inset
shred,
\begin_inset LatexCommand \index{shred}
\end_inset
is to overwrite
\begin_inset LatexCommand \index{overwrite}
\end_inset
the partition
\begin_inset LatexCommand \index{partition}
\end_inset
2 times
\begin_inset LatexCommand \index{times}
\end_inset
with random
\begin_inset LatexCommand \index{random}
\end_inset
data
\begin_inset LatexCommand \index{data}
\end_inset
(- n 2) then finish
\begin_inset LatexCommand \index{finish}
\end_inset
it up by writing
\begin_inset LatexCommand \index{writing}
\end_inset
over it with zeroes
\begin_inset LatexCommand \index{zeroes}
\end_inset
(-z) and show
\begin_inset LatexCommand \index{show}
\end_inset
you its prog
\begin_inset LatexCommand \index{prog}
\end_inset
ress (-v).
Of course, change
\begin_inset LatexCommand \index{change}
\end_inset
/dev/hda1 to whatever your partition
\begin_inset LatexCommand \index{partition}
\end_inset
is.
Each pass
\begin_inset LatexCommand \index{pass}
\end_inset
can take
\begin_inset LatexCommand \index{take}
\end_inset
some time,
\begin_inset LatexCommand \index{time}
\end_inset
which
\begin_inset LatexCommand \index{which}
\end_inset
is why I set
\begin_inset LatexCommand \index{set}
\end_inset
it to only do 2 random
\begin_inset LatexCommand \index{random}
\end_inset
passes
\begin_inset LatexCommand \index{passes}
\end_inset
instead of the default
\begin_inset LatexCommand \index{default}
\end_inset
25.
You can adjust
\begin_inset LatexCommand \index{adjust}
\end_inset
this number,
\begin_inset LatexCommand \index{number}
\end_inset
of course, to your particular
\begin_inset LatexCommand \index{particular}
\end_inset
level of paranoia
\begin_inset LatexCommand \index{paranoia}
\end_inset
and the amount
\begin_inset LatexCommand \index{amount}
\end_inset
of time
\begin_inset LatexCommand \index{time}
\end_inset
you have.
\layout Quotation
Since shred
\begin_inset LatexCommand \index{shred}
\end_inset
writes on such a low-level,
\begin_inset LatexCommand \index{low-level}
\end_inset
it doesn't actually matter what kind
\begin_inset LatexCommand \index{kind}
\end_inset
of filesystem
\begin_inset LatexCommand \index{filesystem}
\end_inset
is on the partition--everything
\begin_inset LatexCommand \index{partition--everything}
\end_inset
will be unrecoverable.
\begin_inset LatexCommand \index{unrecoverable}
\end_inset
Once shred
\begin_inset LatexCommand \index{shred}
\end_inset
is finished,
\begin_inset LatexCommand \index{finished}
\end_inset
you can shut
\begin_inset LatexCommand \index{shut}
\end_inset
down the machine
\begin_inset LatexCommand \index{machine}
\end_inset
and sell
\begin_inset LatexCommand \index{sell}
\end_inset
or throw
\begin_inset LatexCommand \index{throw}
\end_inset
away the drive
\begin_inset LatexCommand \index{drive}
\end_inset
with peace
\begin_inset LatexCommand \index{peace}
\end_inset
of mind.
\begin_inset LatexCommand \index{mind}
\end_inset
\layout Quotation
\SpecialChar \ldots{}
However, even
\begin_inset LatexCommand \index{even}
\end_inset
shre dding devices
\begin_inset LatexCommand \index{devices}
\end_inset
is not always completely reliable.
\begin_inset LatexCommand \index{reliable}
\end_inset
For example,
\begin_inset LatexCommand \index{example}
\end_inset
most disks
\begin_inset LatexCommand \index{disks}
\end_inset
map
\begin_inset LatexCommand \index{map}
\end_inset
out bad sectors
\begin_inset LatexCommand \index{sectors}
\end_inset
invisibly to the application;
\begin_inset LatexCommand \index{application}
\end_inset
if the bad sectors
\begin_inset LatexCommand \index{sectors}
\end_inset
contain sensitiv
\begin_inset LatexCommand \index{sensitiv}
\end_inset
e data,
\begin_inset LatexCommand \index{data}
\end_inset
`shred' won't be able
\begin_inset LatexCommand \index{able}
\end_inset
to destroy
\begin_inset LatexCommand \index{destroy}
\end_inset
it.
[ shred
\begin_inset LatexCommand \index{shred}
\end_inset
info page
\begin_inset LatexCommand \index{page}
\end_inset
].
\begin_inset Foot
collapsed false
\layout Standard
This information (as quoted) has come from the
\begin_inset Quotes eld
\end_inset
Please, For the Love of All That's Recoverable, Shred Your Hard Drive!
\begin_inset Quotes erd
\end_inset
article, number 18 in the
\begin_inset LatexCommand \ref{references}
\end_inset
\end_inset
\begin_inset Note
collapsed true
\layout SGML
\layout SGML
Be careful
\layout SGML
\layout SGML
If you use this utility remember that the data cannot be recovered with
software (undelete utilities) or even most hardware.
It is recommended that you do not use this utility as root, as you can
destroy anything.
\layout SGML
\layout SGML
\layout SGML
Please DO NOT use this utility if you do not understand how to use it.
\layout SGML
\layout SGML
\end_inset
\layout SGML
\layout SGML
Shredding files doesn't work with all filesystems
\layout SGML
\layout SGML
Please note that as mentioned in the shred manual page (please see the manual
and preferably info pages for more information).
\emph on
shred
\emph default
does not work correctly
\emph on
\emph default
on log-structured or journaled filesystems, such as JFS, ReiserFS, XFS,
Ext3 and many other modern filesystems
\layout SGML
\layout SGML
\layout SGML
\layout SGML
Alternatives to using shred
\layout SGML
shred has its disadvantages when run on a filesystem.
First of all since it has to be installed you cannot run shred on your
operating systems filesystem, you also cannot use shred on a windows machine
easily since you cannot install
\emph on
shred
\emph default
on this machine.
\layout SGML
You may like to try alternatives such as the DBAN project that create
self-booting floppy disks that can completely erase a machines hard disk.
\layout SGML
\layout Standard
You may also like to see how chattr
\begin_inset LatexCommand \index{chattr}
\end_inset
can assist
\begin_inset LatexCommand \index{assist}
\end_inset
you in shredding
\begin_inset LatexCommand \index{shredding}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
once they are removed (it has similar
\begin_inset LatexCommand \index{similar}
\end_inset
problems
\begin_inset LatexCommand \index{problems}
\end_inset
to shred,
\begin_inset LatexCommand \index{shred}
\end_inset
only ext2
\begin_inset LatexCommand \index{ext2}
\end_inset
and ext3
\begin_inset LatexCommand \index{ext3}
\end_inset
style filesystems\SpecialChar \ldots{}
), please see
\begin_inset LatexCommand \ref{file-permissions}
\end_inset
.
\end_deeper
\layout Description
du
\begin_inset LatexCommand \index{du}
\end_inset
Displays information
\begin_inset LatexCommand \index{information}
\end_inset
about file
\begin_inset LatexCommand \index{file}
\end_inset
size.
\begin_inset LatexCommand \index{size}
\end_inset
Use
\emph on
du
\begin_inset LatexCommand \index{du}
\end_inset
filename
\emph default
to display
\begin_inset LatexCommand \index{display}
\end_inset
the size
\begin_inset LatexCommand \index{size}
\end_inset
of a particular
\begin_inset LatexCommand \index{particular}
\end_inset
file.
If you use it on directories
\begin_inset LatexCommand \index{directories}
\end_inset
it will display
\begin_inset LatexCommand \index{display}
\end_inset
the information
\begin_inset LatexCommand \index{information}
\end_inset
on the size
\begin_inset LatexCommand \index{size}
\end_inset
of the files
\begin_inset LatexCommand \index{files}
\end_inset
in the directory
\begin_inset LatexCommand \index{directory}
\end_inset
and each subdirectory.
\begin_inset LatexCommand \index{subdirectory}
\end_inset
\begin_deeper
\layout Standard
\noindent
Options
\begin_inset LatexCommand \index{Options}
\end_inset
for du
\begin_inset LatexCommand \index{du}
\end_inset
(use
\emph on
du
\begin_inset LatexCommand \index{du}
\end_inset
-option(s)
\emph default
):
\layout Itemize
\emph on
-c
\emph default
-- this will make
\emph on
du
\emph default
print
\begin_inset LatexCommand \index{print}
\end_inset
a grand
\begin_inset LatexCommand \index{grand}
\end_inset
total
\begin_inset LatexCommand \index{total}
\end_inset
after all arguments
\begin_inset LatexCommand \index{arguments}
\end_inset
have being processed.
\begin_inset LatexCommand \index{processed}
\end_inset
\layout Itemize
\emph on
-s
\begin_inset LatexCommand \index{-s}
\end_inset
\emph default
-- summarises
\begin_inset LatexCommand \index{summarises}
\end_inset
for each argument
\begin_inset LatexCommand \index{argument}
\end_inset
(prints the total).
\layout Itemize
\noindent
\emph on
-h
\emph default
-- prints
\begin_inset LatexCommand \index{prints}
\end_inset
things in
\begin_inset Quotes eld
\end_inset
human
\begin_inset LatexCommand \index{human}
\end_inset
readable
\begin_inset LatexCommand \index{readable}
\end_inset
\begin_inset Quotes erd
\end_inset
mode;
\begin_inset LatexCommand \index{mode}
\end_inset
for example
\begin_inset LatexCommand \index{example}
\end_inset
printing
\begin_inset LatexCommand \index{printing}
\end_inset
1M (megabyte) rather
\begin_inset LatexCommand \index{rather}
\end_inset
than 1,024,000 (bytes).
\layout Standard
\noindent
Using the
\emph on
-hs
\emph default
options
\begin_inset LatexCommand \index{options}
\end_inset
on a directory
\begin_inset LatexCommand \index{directory}
\end_inset
will display
\begin_inset LatexCommand \index{display}
\end_inset
the total
\begin_inset LatexCommand \index{total}
\end_inset
size
\begin_inset LatexCommand \index{size}
\end_inset
of the directory
\begin_inset LatexCommand \index{directory}
\end_inset
and all subdirectories.
\begin_inset LatexCommand \index{subdirectories}
\end_inset
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
du -options file_directory_or_files
\layout Standard
Example:
\layout Code
du -hs *
\layout Standard
This command
\begin_inset LatexCommand \index{command}
\end_inset
will list
\begin_inset LatexCommand \index{list}
\end_inset
the size
\begin_inset LatexCommand \index{size}
\end_inset
of all files
\begin_inset LatexCommand \index{files}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
and it will list
\begin_inset LatexCommand \index{list}
\end_inset
the size
\begin_inset LatexCommand \index{size}
\end_inset
of subdirectories,
\begin_inset LatexCommand \index{subdirectories}
\end_inset
it will list
\begin_inset LatexCommand \index{list}
\end_inset
things in human-readable
\begin_inset LatexCommand \index{human-readable}
\end_inset
sizes
\begin_inset LatexCommand \index{sizes}
\end_inset
using 1024 Kb
\begin_inset LatexCommand \index{Kb}
\end_inset
is a Megabyte,
\begin_inset LatexCommand \index{Megabyte}
\end_inset
M for megabyte,
\begin_inset LatexCommand \index{megabyte}
\end_inset
K for kilobyte
\begin_inset LatexCommand \index{kilobyte}
\end_inset
etc.
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
could be technically incorrect if they use the MiB and KiB standards\SpecialChar \ldots{}
cos
I think they dont (not sure)
\end_inset
\end_deeper
\layout Description
\noindent
file Attempts
\begin_inset LatexCommand \index{Attempts}
\end_inset
to find
\begin_inset LatexCommand \index{find}
\end_inset
out what type of file
\begin_inset LatexCommand \index{file}
\end_inset
it is, for example
\begin_inset LatexCommand \index{example}
\end_inset
it may say it's: binary,
\begin_inset LatexCommand \index{binary}
\end_inset
an image
\begin_inset LatexCommand \index{image}
\end_inset
file (well it will say jpeg,
\begin_inset LatexCommand \index{jpeg}
\end_inset
bmp
\begin_inset LatexCommand \index{bmp}
\end_inset
et cetera), ASCII
\begin_inset LatexCommand \index{ASCII}
\end_inset
text,
\begin_inset LatexCommand \index{text}
\end_inset
C header
\begin_inset LatexCommand \index{header}
\end_inset
file and many other kinds
\begin_inset LatexCommand \index{kinds}
\end_inset
of files,
\begin_inset LatexCommand \index{files}
\end_inset
it's a very useful utility.
\begin_inset LatexCommand \index{utility}
\end_inset
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
file file_name
\end_deeper
\layout Description
\noindent
stat
\begin_inset LatexCommand \index{stat}
\end_inset
Tells you detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
about a file,
\begin_inset LatexCommand \index{file}
\end_inset
including
\begin_inset LatexCommand \index{including}
\end_inset
inode number
\begin_inset LatexCommand \index{number}
\end_inset
creation/access date.
\begin_inset LatexCommand \index{date}
\end_inset
Also has many advanced
\begin_inset LatexCommand \index{advanced}
\end_inset
options
\begin_inset LatexCommand \index{options}
\end_inset
and uses.
\begin_inset Note
collapsed true
\layout Standard
although I really don't know what the options are used for.
\end_inset
\begin_deeper
\layout Standard
\noindent
For simple use type:
\layout Code
stat file
\end_deeper
\layout Description
dd
\begin_inset LatexCommand \index{dd}
\end_inset
Copies data
\begin_inset LatexCommand \index{data}
\end_inset
on a very low
\begin_inset LatexCommand \index{low}
\end_inset
level and can be used to create copies
\begin_inset LatexCommand \index{copies}
\end_inset
of disks
\begin_inset LatexCommand \index{disks}
\end_inset
\begin_inset LatexCommand \ref{duplicating-disks}
\end_inset
and many other things (for example
\begin_inset LatexCommand \index{example}
\end_inset
CD image
\begin_inset LatexCommand \index{image}
\end_inset
files).
\begin_deeper
\layout Standard
\emph on
dd
\emph default
can also perform
\begin_inset LatexCommand \index{perform}
\end_inset
conversions on files
\begin_inset LatexCommand \index{files}
\end_inset
and vary the block
\begin_inset LatexCommand \index{block}
\end_inset
size used when writing
\begin_inset LatexCommand \index{writing}
\end_inset
the file.
\begin_inset LatexCommand \index{file}
\end_inset
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax, note the block
\begin_inset LatexCommand \index{block}
\end_inset
size and count
\begin_inset LatexCommand \index{count}
\end_inset
are optional
\begin_inset LatexCommand \index{optional}
\end_inset
and you can use files instead of devices\SpecialChar \ldots{}
\layout SGML
\layout SGML
Please note
\layout SGML
\emph on
dd
\emph default
is an advanced and difficult to use command.
Its also very powerful, so be careful what you do with it
\layout SGML
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
need more info on this utility, I've hardly used it.
\end_inset
\layout Code
dd if=/dev/xxx of=/dev/xxx bs=xxxx count=x
\layout SGML
\layout SGML
Warning
\layout SGML
\layout SGML
The command
\emph on
dd
\emph default
is used to work on a very low level.
It can be used to overwrite important information such as your master-boot
record or various important sections of your hard-disk.
Please be careful when using it (especially when working with devices instead
of files).
\layout SGML
\layout SGML
\end_deeper
\layout Description
touch
\begin_inset LatexCommand \index{touch}
\end_inset
This command
\begin_inset LatexCommand \index{command}
\end_inset
is used to create empty
\begin_inset LatexCommand \index{empty}
\end_inset
files,
\begin_inset LatexCommand \index{files}
\end_inset
simply do
\emph on
touch
\begin_inset LatexCommand \index{touch}
\end_inset
file_name
\begin_inset LatexCommand \index{file_name}
\end_inset
\emph default
.
It is also used to update
\begin_inset LatexCommand \index{update}
\end_inset
the timestamps
\begin_inset LatexCommand \index{timestamps}
\end_inset
on files.
\begin_inset LatexCommand \index{files}
\end_inset
\begin_deeper
\layout Standard
\noindent
\emph on
touch
\emph default
can be used to change
\begin_inset LatexCommand \index{change}
\end_inset
the time
\begin_inset LatexCommand \index{time}
\end_inset
and/or date
\begin_inset LatexCommand \index{date}
\end_inset
of a file:
\begin_inset LatexCommand \index{file}
\end_inset
\layout Code
\noindent
touch -t 05070915 my_report.txt
\begin_inset Foot
collapsed false
\layout Standard
This particular command and explanation has been used (with editing) from
the Linux Online Classroom, see [4] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
\layout Standard
\noindent
This command
\begin_inset LatexCommand \index{command}
\end_inset
would change
\begin_inset LatexCommand \index{change}
\end_inset
the time
\begin_inset LatexCommand \index{time}
\end_inset
stamp
\begin_inset LatexCommand \index{stamp}
\end_inset
on my_report.txt
\begin_inset LatexCommand \index{my_report.txt}
\end_inset
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
\family default
\begin_inset LatexCommand \index{default}
\end_inset
so that it would
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
look
\begin_inset LatexCommand \index{look}
\end_inset
like you created it at 9:15.
The first four
\begin_inset LatexCommand \index{four}
\end_inset
digits
\begin_inset LatexCommand \index{digits}
\end_inset
stand for May 7th (0507), in MM-DD (American style), and the last
\begin_inset LatexCommand \index{last}
\end_inset
four (0915) the time,
\begin_inset LatexCommand \index{time}
\end_inset
9:15 in the morning.
\begin_inset LatexCommand \index{morning}
\end_inset
\layout Standard
Instead of using plain
\begin_inset LatexCommand \index{plain}
\end_inset
numbers to change
\begin_inset LatexCommand \index{change}
\end_inset
the time,
\begin_inset LatexCommand \index{time}
\end_inset
you can use options
\begin_inset LatexCommand \index{options}
\end_inset
similar to that of the
\emph on
date
\emph default
tool.
\begin_inset LatexCommand \index{tool}
\end_inset
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
touch -d '5 May 2000' some_file.txt
\layout Standard
You can also use
\emph on
--date=
\emph default
instead of
\emph on
-d.
\emph default
Also have a look
\begin_inset LatexCommand \index{look}
\end_inset
at the date
\begin_inset LatexCommand \index{date}
\end_inset
command under
\begin_inset LatexCommand \ref{date-time-calendars}
\end_inset
for examples
\begin_inset LatexCommand \index{examples}
\end_inset
on using
\emph on
-d
\emph default
and
\emph on
--date=
\emph default
(the syntax
\begin_inset LatexCommand \index{syntax}
\end_inset
for the date
\begin_inset LatexCommand \index{date}
\end_inset
part is exactly
\begin_inset LatexCommand \index{exactly}
\end_inset
the same when using
\emph on
-d
\emph default
or
\emph on
--date
\emph default
).
\end_deeper
\layout Description
split
\begin_inset LatexCommand \index{split}
\end_inset
Splits
\begin_inset LatexCommand \index{Splits}
\end_inset
files into several
\begin_inset LatexCommand \index{several}
\end_inset
smaller
\begin_inset LatexCommand \index{smaller}
\end_inset
files.
\begin_deeper
\layout Standard
\noindent
Use the
\emph on
-b\SpecialChar ~
xx
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to split
\begin_inset LatexCommand \index{split}
\end_inset
into
\emph on
xx
\emph default
bytes,
\begin_inset LatexCommand \index{bytes}
\end_inset
also try
\begin_inset LatexCommand \index{try}
\end_inset
\emph on
-k
\emph default
for kilobytes,
\begin_inset LatexCommand \index{kilobytes}
\end_inset
and
\emph on
-m
\emph default
for megabytes.
\begin_inset LatexCommand \index{megabytes}
\end_inset
You can use it to split text files and any other files\SpecialChar \ldots{}
you can use
\emph on
cat
\emph default
to re-combine
\begin_inset LatexCommand \index{re-combine}
\end_inset
the files.
\begin_inset LatexCommand \index{files}
\end_inset
\layout Standard
\noindent
This may be useful if you have to transfer
\begin_inset LatexCommand \index{transfer}
\end_inset
something to floppy
\begin_inset LatexCommand \index{floppy}
\end_inset
disks
\begin_inset LatexCommand \index{disks}
\end_inset
or you wish to divide
\begin_inset LatexCommand \index{divide}
\end_inset
text files
\begin_inset LatexCommand \index{files}
\end_inset
into certain sizes.
\begin_inset LatexCommand \index{sizes}
\end_inset
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
split -options file
\layout Standard
This will split
\begin_inset LatexCommand \index{split}
\end_inset
the input
\begin_inset LatexCommand \index{input}
\end_inset
file into 1000 lines
\begin_inset LatexCommand \index{lines}
\end_inset
of input
\begin_inset LatexCommand \index{input}
\end_inset
each (thats the default\SpecialChar \ldots{}
), and output
\begin_inset LatexCommand \index{output}
\end_inset
(using the above example), with the input
\begin_inset LatexCommand \index{input}
\end_inset
name file,
\begin_inset LatexCommand \index{file}
\end_inset
\begin_inset Quotes eld
\end_inset
fileaa
\begin_inset Quotes erd
\end_inset
(1st part
\begin_inset LatexCommand \index{part}
\end_inset
of file),
\begin_inset Quotes eld
\end_inset
fileab
\begin_inset Quotes erd
\end_inset
(2nd part
\begin_inset LatexCommand \index{part}
\end_inset
of file),
\begin_inset Quotes eld
\end_inset
fileac
\begin_inset Quotes erd
\end_inset
(3rd part
\begin_inset LatexCommand \index{part}
\end_inset
of file) etc.
until
\begin_inset LatexCommand \index{until}
\end_inset
the there is no more
\begin_inset LatexCommand \index{more}
\end_inset
of the file
\begin_inset LatexCommand \index{file}
\end_inset
left
\begin_inset LatexCommand \index{left}
\end_inset
to split.
\begin_inset LatexCommand \index{split}
\end_inset
\end_deeper
\layout Section
Mass Rename/copy/link Tools
\begin_inset LatexCommand \label{mass-rename}
\end_inset
\layout Standard
There are a few different
\begin_inset LatexCommand \index{different}
\end_inset
ways to perform
\begin_inset LatexCommand \index{perform}
\end_inset
mass
\begin_inset LatexCommand \index{mass}
\end_inset
renaming of files
\begin_inset LatexCommand \index{files}
\end_inset
in GNU/Linux (yes, mass
\begin_inset LatexCommand \index{mass}
\end_inset
renaming is possible!).
There is also a perl
\begin_inset LatexCommand \index{perl}
\end_inset
script that renames
\begin_inset LatexCommand \index{renames}
\end_inset
the extentions
\begin_inset LatexCommand \index{extentions}
\end_inset
on files,
\begin_inset LatexCommand \index{files}
\end_inset
see
\begin_inset LatexCommand \ref{Miscellaneous}
\end_inset
.
\layout Standard
Below are three ways to perform
\begin_inset LatexCommand \index{perform}
\end_inset
mass
\begin_inset LatexCommand \index{mass}
\end_inset
renaming of files,
\begin_inset LatexCommand \index{files}
\end_inset
using the commands
\begin_inset LatexCommand \index{commands}
\end_inset
\emph on
mmv
\emph default
,
\emph on
rename
\emph default
(a perl
\begin_inset LatexCommand \index{perl}
\end_inset
script) or some bash
\begin_inset LatexCommand \index{bash}
\end_inset
shell scripting.
\begin_inset LatexCommand \index{scripting}
\end_inset
\layout Description
\begin_inset Note
collapsed false
\layout Standard
yes this was a subsection converted back to plain description again!
\end_inset
\layout Description
mmv
\begin_inset LatexCommand \index{mmv}
\end_inset
\emph on
mmv
\emph default
is a mass
\begin_inset LatexCommand \index{mass}
\end_inset
move/copy/renaming tool
\begin_inset LatexCommand \index{tool}
\end_inset
that uses standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
to perform
\begin_inset LatexCommand \index{perform}
\end_inset
its functions.
\begin_inset LatexCommand \index{functions}
\end_inset
\begin_deeper
\layout Standard
\emph on
mmv's
\emph default
manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
is quite
\begin_inset LatexCommand \index{quite}
\end_inset
difficult to understand, I have only a limited
\begin_inset LatexCommand \index{limited}
\end_inset
understandi ng
\begin_inset LatexCommand \index{ng}
\end_inset
of this tool.
\begin_inset LatexCommand \index{tool}
\end_inset
However
\emph on
mmv
\emph default
supports
\begin_inset LatexCommand \index{supports}
\end_inset
some standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards.
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
\layout Standard
According to the manual
\begin_inset LatexCommand \index{manual}
\end_inset
the ';' wildcard
\begin_inset LatexCommand \index{wildcard}
\end_inset
is useful for matching
\begin_inset LatexCommand \index{matching}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
at any depth
\begin_inset LatexCommand \index{depth}
\end_inset
in the directory
\begin_inset LatexCommand \index{directory}
\end_inset
tree (ie it will go below the current
\begin_inset LatexCommand \index{current}
\end_inset
directory, recursively).
\layout Standard
An example
\begin_inset LatexCommand \index{example}
\end_inset
of how to use
\emph on
mmv
\begin_inset LatexCommand \index{mmv}
\end_inset
\emph default
is shown
\begin_inset LatexCommand \index{shown}
\end_inset
below:
\layout Code
mmv
\backslash
*.JPG
\backslash
#1.jpg
\layout Standard
The first pattern
\begin_inset LatexCommand \index{pattern}
\end_inset
matches anything with a
\begin_inset Quotes eld
\end_inset
.JPG
\begin_inset Quotes erd
\end_inset
and renames
\begin_inset LatexCommand \index{renames}
\end_inset
each file
\begin_inset LatexCommand \index{file}
\end_inset
(the
\begin_inset Quotes eld
\end_inset
#1
\begin_inset Quotes erd
\end_inset
matches the first wildcard) to
\begin_inset Quotes eld
\end_inset
.jpg
\begin_inset Quotes erd
\end_inset
.
\layout Standard
Each time
\begin_inset LatexCommand \index{time}
\end_inset
you use a
\backslash
(wildcard) you can use a #x to get that wildcard.
\begin_inset LatexCommand \index{wildcard}
\end_inset
Where x is a positive
\begin_inset LatexCommand \index{positive}
\end_inset
number starting
\begin_inset LatexCommand \index{starting}
\end_inset
at 1.
\layout SGML
\layout SGML
mmv Homepage
\layout SGML
You can find
\emph on
mmv
\emph default
on the web
\begin_inset LatexCommand \url[here.]{https://linux.maruhn.com/sec/mmv.html}
\end_inset
\layout SGML
Also be aware that certain options used with
\emph on
mmv
\emph default
are also applicable to other tools in the suite, these include
\emph on
mcp
\emph default
(mass copy),
\emph on
mad
\emph default
(mass append contents of source file to target name),
\emph on
mln
\emph default
(mass link to a source file).
\layout SGML
\layout SGML
\layout SGML
Tip:
\layout SGML
A Java alternative to
\emph on
mmv
\emph default
which runs on both GNU/Linux and Windows is available,
\begin_inset LatexCommand \url[Esomaniac]{https://www.esomaniac.de/}
\end_inset
\layout SGML
\end_deeper
\layout Description
rename
\begin_inset LatexCommand \index{rename}
\end_inset
\emph on
rename
\emph default
is a perl
\begin_inset LatexCommand \index{perl}
\end_inset
script which
\begin_inset LatexCommand \index{which}
\end_inset
can be used to mass
\begin_inset LatexCommand \index{mass}
\end_inset
rename
\begin_inset LatexCommand \index{rename}
\end_inset
files according to a regular
\begin_inset LatexCommand \index{regular}
\end_inset
expression.
\begin_deeper
\layout Standard
An example
\begin_inset LatexCommand \index{example}
\end_inset
for renaming
\begin_inset LatexCommand \index{renaming}
\end_inset
all
\begin_inset Quotes eld
\end_inset
.JPG
\begin_inset Quotes erd
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
to
\begin_inset Quotes eld
\end_inset
.jpg
\begin_inset Quotes erd
\end_inset
is:
\layout Code
rename 's/
\backslash
.JPG$/.jpg/' *.JPG
\layout SGML
\layout SGML
Finding rename
\layout SGML
You can get rename from various places.
I would recommend trying
\begin_inset LatexCommand \url[CPAN Search Site]{https://search.cpan.org}
\end_inset
, I found the script here
\begin_inset LatexCommand \url[Rename Script Version 1.4]{https://search.cpan.org/~pederst/rename-1.4/}
\end_inset
\layout SGML
\end_deeper
\layout Description
Bash\SpecialChar ~
scripting
\begin_inset LatexCommand \index{scripting}
\end_inset
Bash
\begin_inset LatexCommand \index{Bash}
\end_inset
scripting is one way to rename
\begin_inset LatexCommand \index{rename}
\end_inset
files.
You can develop
\begin_inset LatexCommand \index{develop}
\end_inset
a set
\begin_inset LatexCommand \index{set}
\end_inset
of instructions
\begin_inset LatexCommand \index{instructions}
\end_inset
(a script) to rename
\begin_inset LatexCommand \index{rename}
\end_inset
files.
Scripts
\begin_inset LatexCommand \index{Scripts}
\end_inset
are useful if you don't have
\emph on
mmv
\emph default
or
\emph on
rename
\emph default
\SpecialChar \ldots{}
\begin_deeper
\layout Standard
One way to this is shown
\begin_inset LatexCommand \index{shown}
\end_inset
below:
\layout Code
for i in *.JPG;
\layout Code
do mv $i `basename $i JPG`jpg;
\layout Code
done
\layout Standard
Note that the above came script
\begin_inset LatexCommand \index{script}
\end_inset
came from a usenet
\begin_inset LatexCommand \index{usenet}
\end_inset
post.
\begin_inset LatexCommand \index{post}
\end_inset
Unfortunately
\begin_inset LatexCommand \index{Unfortunately}
\end_inset
I do not know the author's name.
\layout Standard
The first line
\begin_inset LatexCommand \index{line}
\end_inset
says find
\begin_inset LatexCommand \index{find}
\end_inset
everything
\begin_inset LatexCommand \index{everything}
\end_inset
with the
\begin_inset Quotes eld
\end_inset
.JPG
\begin_inset Quotes erd
\end_inset
extension
\begin_inset LatexCommand \index{extension}
\end_inset
(capitals only, because unix
\begin_inset LatexCommand \index{unix}
\end_inset
is case sensitive).
\layout Standard
The second line
\begin_inset LatexCommand \index{line}
\end_inset
uses
\emph on
basename
\emph default
(type man
\begin_inset LatexCommand \index{man}
\end_inset
basename for more
\begin_inset LatexCommand \index{more}
\end_inset
details) with the '$i' argument.
\begin_inset LatexCommand \index{argument}
\end_inset
The '$i' is a string
\begin_inset LatexCommand \index{string}
\end_inset
containing the name of the file
\begin_inset LatexCommand \index{file}
\end_inset
that matches.
The next
\begin_inset LatexCommand \index{next}
\end_inset
portion of the line
\begin_inset LatexCommand \index{line}
\end_inset
removes the JPG
\begin_inset LatexCommand \index{JPG}
\end_inset
extension from the end
\begin_inset LatexCommand \index{end}
\end_inset
and adds the jpg
\begin_inset LatexCommand \index{jpg}
\end_inset
extention to each file.
\begin_inset LatexCommand \index{file}
\end_inset
The command
\begin_inset LatexCommand \index{command}
\end_inset
\emph on
mv
\emph default
is run
\begin_inset LatexCommand \index{run}
\end_inset
on the output.
\begin_inset LatexCommand \index{output}
\end_inset
\layout Standard
An alternative
\begin_inset LatexCommand \index{alternative}
\end_inset
is:
\layout Code
for i in *.JPG;
\layout Code
do mv $i ${i%%.JPG}.jpg;
\layout Code
done
\layout Standard
The above script
\begin_inset LatexCommand \index{script}
\end_inset
renames
\begin_inset LatexCommand \index{renames}
\end_inset
files using a built-in
\begin_inset LatexCommand \index{built-in}
\end_inset
bash
\begin_inset LatexCommand \index{bash}
\end_inset
function.
For more
\begin_inset LatexCommand \index{more}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on bash
\begin_inset LatexCommand \index{bash}
\end_inset
scripting
\begin_inset LatexCommand \index{bash scripting}
\end_inset
you may like to see the
\begin_inset LatexCommand \url[advanced bash scripting guide]{https://www.tldp.org/LDP/abs/html/}
\end_inset
, authored
\begin_inset LatexCommand \index{authored}
\end_inset
by Mendel
\begin_inset LatexCommand \index{Mendel}
\end_inset
Cooper.
\end_deeper
\layout Chapter
\noindent
Finding information about the system
\begin_inset LatexCommand \label{Finding-information}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
Just don't see this being used\SpecialChar \ldots{}
re-added time command.
Its more of a programmers tool but can be useful\SpecialChar \ldots{}
\layout Description
logname Prints the user name the user used to login, possibly useful if
you use
\emph on
su
\emph default
a lot.
Doesn't need or take any options.
\layout Standard
Simply type:
\layout Description
logname
\layout Standard
This is a programmers tool! Left it out:
\end_inset
\layout Description
time If you are looking
\begin_inset LatexCommand \index{looking}
\end_inset
for how to change
\begin_inset LatexCommand \index{change}
\end_inset
the time
\begin_inset LatexCommand \index{time}
\end_inset
please refer
\begin_inset LatexCommand \index{refer}
\end_inset
to
\emph on
date
\emph default
here:
\begin_inset LatexCommand \ref{date-time-calendars}
\end_inset
.
\begin_deeper
\layout Standard
\emph on
time
\begin_inset LatexCommand \index{time}
\end_inset
\emph default
is a utility
\begin_inset LatexCommand \index{utility}
\end_inset
to measure
\begin_inset LatexCommand \index{measure}
\end_inset
the amount
\begin_inset LatexCommand \index{amount}
\end_inset
of time
\begin_inset LatexCommand \index{time}
\end_inset
it takes
\begin_inset LatexCommand \index{takes}
\end_inset
a program
\begin_inset LatexCommand \index{program}
\end_inset
to execute.
\begin_inset LatexCommand \index{execute}
\end_inset
It also measures
\begin_inset LatexCommand \index{measures}
\end_inset
CPU
\begin_inset LatexCommand \index{CPU}
\end_inset
usage and displays statistics.
\begin_inset LatexCommand \index{statistics}
\end_inset
\layout Standard
Use
\emph on
time
\begin_inset LatexCommand \index{time}
\end_inset
-v
\emph default
(verbose mode) to display
\begin_inset LatexCommand \index{display}
\end_inset
even
\begin_inset LatexCommand \index{even}
\end_inset
more detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
statistics about the particular
\begin_inset LatexCommand \index{particular}
\end_inset
program.
\begin_inset LatexCommand \index{program}
\end_inset
\layout Standard
Example
\begin_inset LatexCommand \index{Example}
\end_inset
usage:
\layout Code
time program_name options
\end_deeper
\layout Description
\noindent
/proc The files
\begin_inset LatexCommand \index{files}
\end_inset
under the /proc (process information
\begin_inset LatexCommand \index{information}
\end_inset
pseudo file-system) show
\begin_inset LatexCommand \index{show}
\end_inset
various information
\begin_inset LatexCommand \index{information}
\end_inset
about the system.
\begin_inset LatexCommand \index{system}
\end_inset
Consider it a window
\begin_inset LatexCommand \index{window}
\end_inset
to the information
\begin_inset LatexCommand \index{information}
\end_inset
that the kernel
\begin_inset LatexCommand \index{kernel}
\end_inset
uses.
\begin_deeper
\layout Standard
\noindent
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
\noindent
cat /proc/cpuinfo
\layout Standard
\noindent
Displays information
\begin_inset LatexCommand \index{information}
\end_inset
about the CPU.
\begin_inset LatexCommand \index{CPU}
\end_inset
\layout Code
\noindent
less /proc/modules
\emph on
\layout Standard
\noindent
To view
\begin_inset LatexCommand \index{view}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on what kernel-modules
\begin_inset LatexCommand \index{kernel-modules}
\end_inset
are loaded
\begin_inset LatexCommand \index{loaded}
\end_inset
on your system.
\begin_inset LatexCommand \index{system}
\end_inset
\end_deeper
\layout Description
dmesg
\begin_inset LatexCommand \index{dmesg}
\end_inset
\emph on
dmesg
\emph default
can be used to print
\begin_inset LatexCommand \index{print}
\end_inset
(or control) the
\begin_inset Quotes eld
\end_inset
kernel
\begin_inset LatexCommand \index{kernel}
\end_inset
ring buffer
\begin_inset LatexCommand \index{buffer}
\end_inset
\begin_inset Quotes erd
\end_inset
.
\emph on
dmesg
\emph default
is generally used to print
\begin_inset LatexCommand \index{print}
\end_inset
the contents
\begin_inset LatexCommand \index{contents}
\end_inset
of your bootup
\begin_inset LatexCommand \index{bootup}
\end_inset
messages displayed by the kernel.
\begin_inset LatexCommand \index{kernel}
\end_inset
This is often useful when debugging
\begin_inset LatexCommand \index{debugging}
\end_inset
problems.
\begin_inset LatexCommand \index{problems}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
consider removing this one
\end_inset
\begin_deeper
\layout Standard
Simply type:
\layout Code
dmesg
\end_deeper
\layout Description
df
\begin_inset LatexCommand \index{df}
\end_inset
Displays information
\begin_inset LatexCommand \index{information}
\end_inset
about the space
\begin_inset LatexCommand \index{space}
\end_inset
on mounted
\begin_inset LatexCommand \index{mounted}
\end_inset
file-systems.
Use the
\emph on
.h
\begin_inset LatexCommand \index{.h}
\end_inset
\begin_inset LatexCommand \index{-h}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to have
\emph on
df
\emph default
list
\begin_inset LatexCommand \index{list}
\end_inset
the space
\begin_inset LatexCommand \index{space}
\end_inset
in a 'human readable' format.
\begin_inset LatexCommand \index{format}
\end_inset
ie.
if there are 1024 kilobytes
\begin_inset LatexCommand \index{kilobytes}
\end_inset
left (approximately) then df
\begin_inset LatexCommand \index{df}
\end_inset
will say there is 1MB
\begin_inset LatexCommand \index{1MB}
\end_inset
left.
\begin_inset LatexCommand \index{left}
\end_inset
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
df -options /dev/hdx
\layout Standard
The latter part
\begin_inset LatexCommand \index{part}
\end_inset
is optional,
\begin_inset LatexCommand \index{optional}
\end_inset
you can simply use
\emph on
df
\emph default
with or without options
\begin_inset LatexCommand \index{options}
\end_inset
to list
\begin_inset LatexCommand \index{list}
\end_inset
space
\begin_inset LatexCommand \index{space}
\end_inset
on all file-systems.
\begin_inset LatexCommand \index{file-systems}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
confused on the mebibyte vs megabyte issue again.
1 megabyte = 1000 kilobytes according to the new NIST standard and one
mega-binary-byte = 1024 kilobytes (1 MiB) a mebibyte\SpecialChar \ldots{}
but most people still
use the old terms\SpecialChar \ldots{}
1MB is CS is still 2^10, they use the old standards\SpecialChar \ldots{}
\SpecialChar \ldots{}
therefore
I use the old standards.
I think the new standards sort-of didn't happen.
\end_inset
\end_deeper
\layout Description
\noindent
who
\begin_inset LatexCommand \index{who}
\end_inset
Displays information
\begin_inset LatexCommand \index{information}
\end_inset
on which
\begin_inset LatexCommand \index{which}
\end_inset
users are logged
\begin_inset LatexCommand \index{logged}
\end_inset
into the system
\begin_inset LatexCommand \index{system}
\end_inset
including the time
\begin_inset LatexCommand \index{time}
\end_inset
they logged
\begin_inset LatexCommand \index{logged}
\end_inset
in.
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
who
\end_deeper
\layout Description
w
\begin_inset LatexCommand \index{w}
\end_inset
Displays information
\begin_inset LatexCommand \index{information}
\end_inset
on who is logged
\begin_inset LatexCommand \index{logged}
\end_inset
into the system
\begin_inset LatexCommand \index{system}
\end_inset
and what they are doing (ie.
the processes
\begin_inset LatexCommand \index{processes}
\end_inset
they are running).
It's similar
\begin_inset LatexCommand \index{similar}
\end_inset
to
\emph on
who
\emph default
but displays slightly different
\begin_inset LatexCommand \index{different}
\end_inset
information.
\begin_inset LatexCommand \index{information}
\end_inset
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
w
\end_deeper
\layout Description
users
\begin_inset LatexCommand \index{users}
\end_inset
Very similar
\begin_inset LatexCommand \index{similar}
\end_inset
to
\emph on
who
\emph default
except it only prints
\begin_inset LatexCommand \index{prints}
\end_inset
out the user
\begin_inset LatexCommand \index{user}
\end_inset
names who are currently logged
\begin_inset LatexCommand \index{logged}
\end_inset
in.
(Doesn't need or take
\begin_inset LatexCommand \index{take}
\end_inset
any options).
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
users
\end_deeper
\layout Description
last
\begin_inset LatexCommand \index{last}
\end_inset
Displays records
\begin_inset LatexCommand \index{records}
\end_inset
of when various users
\begin_inset LatexCommand \index{users}
\end_inset
have logged
\begin_inset LatexCommand \index{logged}
\end_inset
in or out.
This includes
\begin_inset LatexCommand \index{includes}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on when the computer
\begin_inset LatexCommand \index{computer}
\end_inset
was rebooted.
\begin_inset LatexCommand \index{rebooted}
\end_inset
\begin_deeper
\layout Standard
To execute
\begin_inset LatexCommand \index{execute}
\end_inset
this simply type:
\layout Code
last
\end_deeper
\layout Description
lastlog
\begin_inset LatexCommand \index{lastlog}
\end_inset
Displays a list
\begin_inset LatexCommand \index{list}
\end_inset
of users
\begin_inset LatexCommand \index{users}
\end_inset
and what day/time they logged
\begin_inset LatexCommand \index{logged}
\end_inset
into the system.
\begin_inset LatexCommand \index{system}
\end_inset
\begin_deeper
\layout Standard
Simply type:
\layout Code
lastlog
\end_deeper
\layout Description
\noindent
whoami
\begin_inset LatexCommand \index{whoami}
\end_inset
Tells the user
\begin_inset LatexCommand \index{user}
\end_inset
who they are currently logged
\begin_inset LatexCommand \index{logged}
\end_inset
in as.
Doesn't need or take
\begin_inset LatexCommand \index{take}
\end_inset
any options.
\begin_inset LatexCommand \index{options}
\end_inset
\begin_deeper
\layout Standard
\noindent
Simply type:
\layout Code
whoami
\end_deeper
\layout Description
\noindent
free
\begin_inset LatexCommand \index{free}
\end_inset
Displays memory
\begin_inset LatexCommand \index{memory}
\end_inset
statistics
\begin_inset LatexCommand \index{statistics}
\end_inset
(total, free, used, cached,
\begin_inset LatexCommand \index{cached}
\end_inset
swap).
Use the
\emph on
-t
\begin_inset LatexCommand \index{-t}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to display
\begin_inset LatexCommand \index{display}
\end_inset
totals
\begin_inset LatexCommand \index{totals}
\end_inset
of everything
\begin_inset LatexCommand \index{everything}
\end_inset
and use the
\emph on
-m
\begin_inset LatexCommand \index{-m}
\end_inset
\emph default
to display
\begin_inset LatexCommand \index{display}
\end_inset
memory
\begin_inset LatexCommand \index{memory}
\end_inset
in megabytes.
\begin_inset LatexCommand \index{megabytes}
\end_inset
\begin_deeper
\layout Standard
\noindent
Example:
\layout Code
free -tm
\layout Standard
This will display
\begin_inset LatexCommand \index{display}
\end_inset
the memory
\begin_inset LatexCommand \index{memory}
\end_inset
usage including
\begin_inset LatexCommand \index{including}
\end_inset
totals
\begin_inset LatexCommand \index{totals}
\end_inset
in megabytes.
\begin_inset LatexCommand \index{megabytes}
\end_inset
\end_deeper
\layout Description
uptime
\begin_inset LatexCommand \index{uptime}
\end_inset
Print
\begin_inset LatexCommand \index{Print}
\end_inset
how long
\begin_inset LatexCommand \index{long}
\end_inset
the computer
\begin_inset LatexCommand \index{computer}
\end_inset
has been
\begin_inset Quotes eld
\end_inset
up
\begin_inset Quotes erd
\end_inset
, how long
\begin_inset LatexCommand \index{long}
\end_inset
the computer
\begin_inset LatexCommand \index{computer}
\end_inset
has been running.
\begin_inset LatexCommand \index{running}
\end_inset
It also displays the number
\begin_inset LatexCommand \index{number}
\end_inset
of users
\begin_inset LatexCommand \index{users}
\end_inset
and the processor
\begin_inset LatexCommand \index{processor}
\end_inset
load (how hard the CPU has been worked\SpecialChar \ldots{}
).
\begin_deeper
\layout Standard
Note: the
\emph on
w
\emph default
command
\begin_inset LatexCommand \index{command}
\end_inset
displays uptime's output
\begin_inset LatexCommand \index{output}
\end_inset
as the top
\begin_inset LatexCommand \index{top}
\end_inset
line of its output
\begin_inset LatexCommand \index{output}
\end_inset
when it is executed (ie.
you could use
\emph on
w
\emph default
instead\SpecialChar \ldots{}
).
\end_deeper
\layout Description
uname
\emph on
uname
\begin_inset LatexCommand \index{uname}
\end_inset
\emph default
is used to print
\begin_inset LatexCommand \index{print}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on the system
\begin_inset LatexCommand \index{system}
\end_inset
such as OS
\begin_inset LatexCommand \index{OS}
\end_inset
type, kernel
\begin_inset LatexCommand \index{kernel}
\end_inset
version
\begin_inset LatexCommand \index{version}
\end_inset
et cetera.
\begin_inset LatexCommand \index{cetera}
\end_inset
\begin_deeper
\layout Standard
Some
\emph on
uname
\emph default
options:
\begin_inset LatexCommand \index{options}
\end_inset
\layout Itemize
\emph on
-a
\emph default
--- print
\begin_inset LatexCommand \index{print}
\end_inset
all the available
\begin_inset LatexCommand \index{available}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
\layout Itemize
\emph on
-m
\emph default
--- print
\begin_inset LatexCommand \index{print}
\end_inset
only information
\begin_inset LatexCommand \index{information}
\end_inset
related to the machine
\begin_inset LatexCommand \index{machine}
\end_inset
itself.
\layout Itemize
\emph on
-n
\emph default
--- print
\begin_inset LatexCommand \index{print}
\end_inset
only the machine
\begin_inset LatexCommand \index{machine}
\end_inset
hostname.
\layout Itemize
\emph on
-r
\emph default
--- print
\begin_inset LatexCommand \index{print}
\end_inset
the release
\begin_inset LatexCommand \index{release}
\end_inset
number of the current
\begin_inset LatexCommand \index{current}
\end_inset
kernel.
\begin_inset LatexCommand \index{kernel}
\end_inset
\layout Itemize
\emph on
-s
\emph default
--- print
\begin_inset LatexCommand \index{print}
\end_inset
the operating
\begin_inset LatexCommand \index{operating}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
name
\layout Itemize
\emph on
-p
\emph default
--- print
\begin_inset LatexCommand \index{print}
\end_inset
the processor
\begin_inset LatexCommand \index{processor}
\end_inset
type.
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
uname -options
\end_deeper
\layout Description
xargs
\begin_inset LatexCommand \index{xargs}
\end_inset
Note that
\emph on
xargs
\emph default
is an advanced,
\begin_inset LatexCommand \index{advanced}
\end_inset
confusing,
\begin_inset LatexCommand \index{confusing}
\end_inset
yet powerful
\begin_inset LatexCommand \index{powerful}
\end_inset
command.
\begin_inset LatexCommand \index{command}
\end_inset
\emph on
xargs
\emph default
is a command
\begin_inset LatexCommand \index{command}
\end_inset
used to run
\begin_inset LatexCommand \index{run}
\end_inset
other commands
\begin_inset LatexCommand \index{commands}
\end_inset
as many times
\begin_inset LatexCommand \index{times}
\end_inset
as necessary, this way it prevents any kind of overload\SpecialChar \ldots{}
When you run
\begin_inset LatexCommand \index{run}
\end_inset
a command
\begin_inset LatexCommand \index{command}
\end_inset
then
\emph on
| xargs
\begin_inset LatexCommand \index{xargs}
\end_inset
command2
\begin_inset LatexCommand \index{command2}
\end_inset
\emph default
.
The results
\begin_inset LatexCommand \index{results}
\end_inset
of command1
\begin_inset LatexCommand \index{command1}
\end_inset
will be passed
\begin_inset LatexCommand \index{passed}
\end_inset
to command2.
\begin_inset LatexCommand \index{command2}
\end_inset
\begin_deeper
\layout Standard
Understanding
\emph on
xargs
\emph default
tends
\begin_inset LatexCommand \index{tends}
\end_inset
to be very difficult and my explanation
\begin_inset LatexCommand \index{explanation}
\end_inset
is not the best.
Refer
\begin_inset LatexCommand \index{Refer}
\end_inset
to the examples
\begin_inset LatexCommand \index{examples}
\end_inset
below or try
\begin_inset LatexCommand \index{try}
\end_inset
[6] of the
\begin_inset LatexCommand \ref{references}
\end_inset
for another
\emph on
xargs
\emph default
tutorial.
\begin_inset LatexCommand \index{tutorial}
\end_inset
\layout SGML
\layout SGML
Alternatives to using xargs
\layout SGML
Please note that the below explanation of
\emph on
xargs
\emph default
is not the strongest (at the time of writing I could not find anything
better :()).
Alternatives may include writing a simple bash script to do the job which
is not the most difficult task in the world.
\layout SGML
\layout Standard
Examples:
\layout Code
ls | xargs grep work
\layout Standard
The first command
\begin_inset LatexCommand \index{command}
\end_inset
is obvious, it will list
\begin_inset LatexCommand \index{list}
\end_inset
the files
\begin_inset LatexCommand \index{files}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
For each line
\begin_inset LatexCommand \index{line}
\end_inset
of output
\begin_inset LatexCommand \index{output}
\end_inset
of
\emph on
ls
\emph default
,
\emph on
xargs
\emph default
will run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
grep
\emph default
on that particular
\begin_inset LatexCommand \index{particular}
\end_inset
line
\begin_inset LatexCommand \index{line}
\end_inset
and look
\begin_inset LatexCommand \index{look}
\end_inset
for the string
\begin_inset LatexCommand \index{string}
\end_inset
\begin_inset Quotes eld
\end_inset
work
\begin_inset Quotes erd
\end_inset
.
The output
\begin_inset LatexCommand \index{output}
\end_inset
have the each time
\begin_inset LatexCommand \index{time}
\end_inset
\emph on
grep
\emph default
is executed on a new
\begin_inset LatexCommand \index{new}
\end_inset
line, the output
\begin_inset LatexCommand \index{output}
\end_inset
would look
\begin_inset LatexCommand \index{look}
\end_inset
like:
\layout Code
file_name: results_of_grep
\layout Standard
If
\emph on
grep
\emph default
didn't find
\begin_inset LatexCommand \index{find}
\end_inset
the word
\begin_inset LatexCommand \index{word}
\end_inset
then there would be no output
\begin_inset LatexCommand \index{output}
\end_inset
if it had an error
\begin_inset LatexCommand \index{error}
\end_inset
then it will output
\begin_inset LatexCommand \index{output}
\end_inset
the error.
\begin_inset LatexCommand \index{error}
\end_inset
Obviously this isn't very useful (you could just do
\emph on
grep
\begin_inset LatexCommand \index{grep}
\end_inset
*
\emph default
, its just an example\SpecialChar \ldots{}
\layout Standard
\emph on
xargs
\begin_inset LatexCommand \index{xargs}
\end_inset
\emph default
also takes
\begin_inset LatexCommand \index{takes}
\end_inset
various options:
\begin_inset LatexCommand \index{options}
\end_inset
\layout Itemize
\emph on
-nx
\emph default
--- will group
\begin_inset LatexCommand \index{group}
\end_inset
the first x commands
\begin_inset LatexCommand \index{commands}
\end_inset
together
\layout Itemize
\emph on
-lx
\emph default
--- xargs
\begin_inset LatexCommand \index{xargs}
\end_inset
will execute
\begin_inset LatexCommand \index{execute}
\end_inset
the command
\begin_inset LatexCommand \index{command}
\end_inset
for every x number
\begin_inset LatexCommand \index{number}
\end_inset
of lines
\begin_inset LatexCommand \index{lines}
\end_inset
of input
\begin_inset LatexCommand \index{input}
\end_inset
\layout Itemize
\emph on
-p
\emph default
--- prompt
\begin_inset LatexCommand \index{prompt}
\end_inset
whether or not to execute
\begin_inset LatexCommand \index{execute}
\end_inset
this particular
\begin_inset LatexCommand \index{particular}
\end_inset
string
\begin_inset LatexCommand \index{string}
\end_inset
\layout Itemize
\emph on
-t
\emph default
--- (tell) be verbose,
\begin_inset LatexCommand \index{verbose}
\end_inset
echo
\begin_inset LatexCommand \index{echo}
\end_inset
each command
\begin_inset LatexCommand \index{command}
\end_inset
before performing
\begin_inset LatexCommand \index{performing}
\end_inset
it
\layout Itemize
\emph on
-i
\emph default
--- will use substitution
\begin_inset LatexCommand \index{substitution}
\end_inset
similar
\begin_inset LatexCommand \index{similar}
\end_inset
to find's -exec
\begin_inset LatexCommand \index{-exec}
\end_inset
option,
\begin_inset LatexCommand \index{option}
\end_inset
it will execute
\begin_inset LatexCommand \index{execute}
\end_inset
certain commands
\begin_inset LatexCommand \index{commands}
\end_inset
on something.
\layout Standard
Example:
\layout Code
ls dir1 | xargs -i mv dir1/'{}' dir2/'{}'
\layout Standard
The {} would be substituted
\begin_inset LatexCommand \index{substituted}
\end_inset
for the current
\begin_inset LatexCommand \index{current}
\end_inset
input (in this example
\begin_inset LatexCommand \index{example}
\end_inset
the current file/directory) listed
\begin_inset LatexCommand \index{listed}
\end_inset
within the directory.
\begin_inset LatexCommand \index{directory}
\end_inset
The above command
\begin_inset LatexCommand \index{command}
\end_inset
would move
\begin_inset LatexCommand \index{move}
\end_inset
every file
\begin_inset LatexCommand \index{file}
\end_inset
listed
\begin_inset LatexCommand \index{listed}
\end_inset
in dir1
\begin_inset LatexCommand \index{dir1}
\end_inset
to dir2.
\begin_inset LatexCommand \index{dir2}
\end_inset
Obviously this command
\begin_inset LatexCommand \index{command}
\end_inset
won't be too useful, it would be easier to go to dir1
\begin_inset LatexCommand \index{dir1}
\end_inset
and type
\emph on
mv
\begin_inset LatexCommand \index{mv}
\end_inset
* ../dir2
\layout Standard
Here is a more
\begin_inset LatexCommand \index{more}
\end_inset
useful example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
\backslash
ls *.wav | xargs -i lame -h '{}' '{}'.mp3
\layout Standard
This would find
\begin_inset LatexCommand \index{find}
\end_inset
all wave
\begin_inset LatexCommand \index{wave}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
within the current
\begin_inset LatexCommand \index{current}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
and convert
\begin_inset LatexCommand \index{convert}
\end_inset
them to mp3
\begin_inset LatexCommand \index{mp3}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
(encoded with lame) and append
\begin_inset LatexCommand \index{append}
\end_inset
a .mp3 to the end
\begin_inset LatexCommand \index{end}
\end_inset
of the file, unfortunately it doesn't remove the .wav and so its not too
useful\SpecialChar \ldots{}
but it works.
\begin_inset LatexCommand \index{works}
\end_inset
\end_deeper
\layout Section
Date/Time/Calendars
\begin_inset LatexCommand \label{date-time-calendars}
\end_inset
\layout Standard
There is one command
\begin_inset LatexCommand \index{command}
\end_inset
to change
\begin_inset LatexCommand \index{change}
\end_inset
both the date
\begin_inset LatexCommand \index{date}
\end_inset
and time
\begin_inset LatexCommand \index{time}
\end_inset
on a UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
like system,
\begin_inset LatexCommand \index{system}
\end_inset
\emph on
date
\emph default
, there is also a simple calendar
\begin_inset LatexCommand \index{calendar}
\end_inset
utility,
\emph on
cal
\emph default
.
If you are looking
\begin_inset LatexCommand \index{looking}
\end_inset
to change
\begin_inset LatexCommand \index{change}
\end_inset
the time-stamps
\begin_inset LatexCommand \index{time-stamps}
\end_inset
on files
\begin_inset LatexCommand \index{files}
\end_inset
please see
\begin_inset LatexCommand \ref{Finding-information}
\end_inset
\layout Description
date Tells you the date
\begin_inset LatexCommand \index{date}
\end_inset
(and the time) and is also used to set
\begin_inset LatexCommand \index{set}
\end_inset
the date/time.
\begin_deeper
\layout Standard
To set
\begin_inset LatexCommand \index{set}
\end_inset
the date,
\begin_inset LatexCommand \index{date}
\end_inset
type
\emph on
date
\begin_inset LatexCommand \index{date}
\end_inset
MM:DD:YYYY
\emph default
(American style
\begin_inset LatexCommand \index{style}
\end_inset
date) where MM is month,
\begin_inset LatexCommand \index{month}
\end_inset
DD
\begin_inset LatexCommand \index{DD}
\end_inset
is the number
\begin_inset LatexCommand \index{number}
\end_inset
of days
\begin_inset LatexCommand \index{days}
\end_inset
within the month
\begin_inset LatexCommand \index{month}
\end_inset
and YYYY
\begin_inset LatexCommand \index{YYYY}
\end_inset
is the year.
\begin_inset LatexCommand \index{year}
\end_inset
\layout Standard
For example
\begin_inset LatexCommand \index{example}
\end_inset
to set
\begin_inset LatexCommand \index{set}
\end_inset
the date
\begin_inset LatexCommand \index{date}
\end_inset
to the 1st January 2000 you would type:
\layout Code
date 01:01:2000
\layout Standard
To set
\begin_inset LatexCommand \index{set}
\end_inset
the time
\begin_inset LatexCommand \index{time}
\end_inset
(where the
\emph on
-s
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
is to set
\begin_inset LatexCommand \index{set}
\end_inset
a new
\begin_inset LatexCommand \index{new}
\end_inset
time), type:
\layout Code
date
\emph on
\emph default
-s hh:mm:ss
\layout Standard
Another useful option
\begin_inset LatexCommand \index{option}
\end_inset
you can use is
\emph on
--date=
\begin_inset Quotes eld
\end_inset
string
\begin_inset Quotes erd
\end_inset
\emph default
(or
\emph on
-d
\emph default
\emph on
\begin_inset Quotes eld
\end_inset
string
\begin_inset Quotes erd
\end_inset
\emph default
) option
\begin_inset LatexCommand \index{option}
\end_inset
to display
\begin_inset LatexCommand \index{display}
\end_inset
a date
\begin_inset LatexCommand \index{date}
\end_inset
from x days
\begin_inset LatexCommand \index{days}
\end_inset
ago or in x days
\begin_inset LatexCommand \index{days}
\end_inset
(or x weeks,
\begin_inset LatexCommand \index{weeks}
\end_inset
months,
\begin_inset LatexCommand \index{months}
\end_inset
years
\begin_inset LatexCommand \index{years}
\end_inset
et cetera).
See the examples
\begin_inset LatexCommand \index{examples}
\end_inset
below.
\layout Standard
Examples:
\layout Code
date --date="3 months 1 day ago"
\layout Standard
Will print
\begin_inset LatexCommand \index{print}
\end_inset
the date
\begin_inset LatexCommand \index{date}
\end_inset
3 months
\begin_inset LatexCommand \index{months}
\end_inset
and 1 day
\begin_inset LatexCommand \index{day}
\end_inset
ago from the current
\begin_inset LatexCommand \index{current}
\end_inset
date.
Note that
\emph on
--date=
\begin_inset Quotes erd
\end_inset
x month
\begin_inset LatexCommand \index{month}
\end_inset
x day
\begin_inset LatexCommand \index{day}
\end_inset
ago
\begin_inset Quotes erd
\end_inset
\emph default
and
\emph on
-d
\begin_inset LatexCommand \index{-d}
\end_inset
\begin_inset Quotes eld
\end_inset
x month
\begin_inset LatexCommand \index{month}
\end_inset
x day
\begin_inset LatexCommand \index{day}
\end_inset
ago
\begin_inset Quotes erd
\end_inset
\emph default
are equivalent.
\begin_inset LatexCommand \index{equivalent}
\end_inset
\layout Code
date -d "3 days"
\layout Standard
The above command
\begin_inset LatexCommand \index{command}
\end_inset
will print
\begin_inset LatexCommand \index{print}
\end_inset
the date
\begin_inset LatexCommand \index{date}
\end_inset
3 days
\begin_inset LatexCommand \index{days}
\end_inset
forward
\begin_inset LatexCommand \index{forward}
\end_inset
in time
\begin_inset LatexCommand \index{time}
\end_inset
from now.
\end_deeper
\layout Description
cal
\begin_inset LatexCommand \index{cal}
\end_inset
Typing
\emph on
cal
\emph default
will give you the calendar
\begin_inset LatexCommand \index{calendar}
\end_inset
of the present
\begin_inset LatexCommand \index{present}
\end_inset
month on your screen,
\begin_inset LatexCommand \index{screen}
\end_inset
in the nice
\begin_inset LatexCommand \index{nice}
\end_inset
standard calendar
\begin_inset LatexCommand \index{calendar}
\end_inset
format.
There are various options
\begin_inset LatexCommand \index{options}
\end_inset
to customise
\begin_inset LatexCommand \index{customise}
\end_inset
the calendar,
\begin_inset LatexCommand \index{calendar}
\end_inset
refer
\begin_inset LatexCommand \index{refer}
\end_inset
to the info/man page.
\begin_inset LatexCommand \index{page}
\end_inset
\begin_deeper
\layout Standard
Example:
\layout Code
cal -y year
\layout Standard
Will display
\begin_inset LatexCommand \index{display}
\end_inset
a calendar
\begin_inset LatexCommand \index{calendar}
\end_inset
for a specific
\begin_inset LatexCommand \index{specific}
\end_inset
year, simply use cal
\begin_inset LatexCommand \index{cal}
\end_inset
-y
\begin_inset LatexCommand \index{-y}
\end_inset
to print
\begin_inset LatexCommand \index{print}
\end_inset
the calendar
\begin_inset LatexCommand \index{calendar}
\end_inset
for the current
\begin_inset LatexCommand \index{current}
\end_inset
year.
\layout Code
cal 2 2004
\layout Standard
This will display
\begin_inset LatexCommand \index{display}
\end_inset
the calendar
\begin_inset LatexCommand \index{calendar}
\end_inset
for February 2004
\end_deeper
\layout Section
Finding information about partitions
\begin_inset LatexCommand \label{hard-disk-partition-info}
\end_inset
\layout Standard
There are a number
\begin_inset LatexCommand \index{number}
\end_inset
of ways to find
\begin_inset LatexCommand \index{find}
\end_inset
out information
\begin_inset LatexCommand \index{information}
\end_inset
on your hard disk
\begin_inset LatexCommand \index{disk}
\end_inset
drives, for information
\begin_inset LatexCommand \index{information}
\end_inset
on mounted
\begin_inset LatexCommand \index{mounted}
\end_inset
partitions also try
\begin_inset LatexCommand \index{try}
\end_inset
\emph on
df
\begin_inset LatexCommand \index{df}
\end_inset
\emph default
in
\begin_inset LatexCommand \ref{Finding-information}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
the idea behind this section is that people may need to find out which partition
on which hard disk has a particular file system.
Might need a better name
\layout Standard
was subsectioned.
Now just plain description style again
\end_inset
\layout Description
Using\SpecialChar ~
the\SpecialChar ~
proc\SpecialChar ~
filesystem
\begin_inset LatexCommand \index{filesystem}
\end_inset
You can look
\begin_inset LatexCommand \index{look}
\end_inset
through the information
\begin_inset LatexCommand \index{information}
\end_inset
in the relevant
\begin_inset LatexCommand \index{relevant}
\end_inset
area
\begin_inset LatexCommand \index{area}
\end_inset
of the proc
\begin_inset LatexCommand \index{proc}
\end_inset
filesystem,
\begin_inset LatexCommand \index{proc filesystem}
\end_inset
\begin_inset LatexCommand \index{filesystem}
\end_inset
under the directory
\begin_inset LatexCommand \index{directory}
\end_inset
of either /proc/ide/ or /proc/ide?/hd? where the first question
\begin_inset LatexCommand \index{question}
\end_inset
mark is a number
\begin_inset LatexCommand \index{number}
\end_inset
and the second is a letter
\begin_inset LatexCommand \index{letter}
\end_inset
(starting with 'a').
\begin_deeper
\layout Standard
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
cd /proc/ide0/hda
\layout Standard
Under this directory
\begin_inset LatexCommand \index{directory}
\end_inset
there will be various information
\begin_inset LatexCommand \index{information}
\end_inset
on the hard drive
\begin_inset LatexCommand \index{drive}
\end_inset
or cdrom
\begin_inset LatexCommand \index{cdrom}
\end_inset
connected.
\end_deeper
\layout Description
Using\SpecialChar ~
fdisk
\begin_inset LatexCommand \label{using-fdisk}
\end_inset
Using
\emph on
fdisk
\emph default
with the
\emph on
-l
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
will output
\begin_inset LatexCommand \index{output}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on any hard drives
\begin_inset LatexCommand \index{drives}
\end_inset
connected
\begin_inset LatexCommand \index{connected}
\end_inset
to the system
\begin_inset LatexCommand \index{system}
\end_inset
and information
\begin_inset LatexCommand \index{information}
\end_inset
on their partitions
\begin_inset LatexCommand \index{partitions}
\end_inset
(for example,
\begin_inset LatexCommand \index{example}
\end_inset
the type of partition).
\begin_deeper
\layout Standard
Information
\begin_inset LatexCommand \index{Information}
\end_inset
relating to using
\emph on
fdisk
\emph default
to partition
\begin_inset LatexCommand \index{partition}
\end_inset
hard disks
\begin_inset LatexCommand \index{disks}
\end_inset
can be found
\begin_inset LatexCommand \index{found}
\end_inset
in your distributions
\begin_inset LatexCommand \index{distributions}
\end_inset
documentation,
\begin_inset LatexCommand \index{documentation}
\end_inset
the
\emph on
fdisk
\emph default
manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
or online.
\begin_inset LatexCommand \index{online}
\end_inset
\layout SGML
\layout SGML
Root Access Required
\layout SGML
This command needs root access to work
\layout SGML
\end_deeper
\layout Chapter
Controlling the system
\begin_inset LatexCommand \label{Controlling-the-system}
\end_inset
\layout Standard
The controlling
\begin_inset LatexCommand \index{controlling}
\end_inset
the system
\begin_inset LatexCommand \index{system}
\end_inset
chapter details
\begin_inset LatexCommand \index{details}
\end_inset
commands that you may wish to use to interact
\begin_inset LatexCommand \index{interact}
\end_inset
with devices
\begin_inset LatexCommand \index{devices}
\end_inset
on your system
\begin_inset LatexCommand \index{system}
\end_inset
and then details
\begin_inset LatexCommand \index{details}
\end_inset
how to control
\begin_inset LatexCommand \index{control}
\end_inset
processes
\begin_inset LatexCommand \index{processes}
\end_inset
and services/daemons.
\layout Description
\noindent
eject
\emph on
eject
\begin_inset LatexCommand \index{eject}
\end_inset
\emph default
simply tells
\begin_inset LatexCommand \index{tells}
\end_inset
a device
\begin_inset LatexCommand \index{device}
\end_inset
to open
\begin_inset LatexCommand \index{open}
\end_inset
(eject).
Useful for cdrom/DVD drives.
\begin_inset LatexCommand \index{drives}
\end_inset
\begin_deeper
\layout Standard
\noindent
For example
\begin_inset LatexCommand \index{example}
\end_inset
the command
\begin_inset LatexCommand \index{command}
\end_inset
below would eject
\begin_inset LatexCommand \index{eject}
\end_inset
the cdrom-drive
\begin_inset LatexCommand \index{cdrom-drive}
\end_inset
(if your cdrom
\begin_inset LatexCommand \index{cdrom}
\end_inset
is linked
\begin_inset LatexCommand \index{linked}
\end_inset
to /dev/cdrom):
\layout Code
eject /dev/cdrom
\layout SGML
\layout SGML
This won't work unless
\layout SGML
\layout SGML
This will only work if the user has permission to mount the partition.
Please see the tip in
\begin_inset LatexCommand \ref{mounting-and-unmounting}
\end_inset
for more information.
\layout SGML
\layout SGML
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
should confirm the above fact
\end_inset
\end_deeper
\layout Section
\noindent
Mounting and Unmounting (Floppy/CDROM/Hard-drive Partitions)
\begin_inset LatexCommand \label{mounting-and-unmounting}
\end_inset
\layout SGML
\layout SGML
Allowing Users to mount partitions
\layout SGML
\layout SGML
By default a UNIX system will allow normal users to unmount partitions.
However unless given permission by the super-user, users will not be allowed
to mount partitions.
\layout SGML
\layout SGML
\layout SGML
The commands listed below will not work for normal users unless users have
permission to mount that device.
\layout SGML
\layout SGML
\layout SGML
If your particular distribution is setup not to allow users to mount partitions
its not very hard to change this, simply edit the
\emph on
/etc/fstab
\emph default
file (as root) and:
\layout SGML
\layout SGML
\layout SGML
Replace the word "defaults" with "user"
\series bold
or
\series default
\layout SGML
Add "user" to the end of the options list for the particular partition(s
).
\layout SGML
\layout SGML
\layout Description
mount
\begin_inset LatexCommand \index{mount}
\end_inset
Mount a device.
\begin_inset LatexCommand \index{device}
\end_inset
Attach
\begin_inset LatexCommand \index{Attach}
\end_inset
the device
\begin_inset LatexCommand \index{device}
\end_inset
to the file-system
\begin_inset LatexCommand \index{file-system}
\end_inset
hierarchy
\begin_inset LatexCommand \index{hierarchy}
\end_inset
(the tree
\begin_inset LatexCommand \index{tree}
\end_inset
( / )).
This needs to be done so you can access
\begin_inset LatexCommand \index{access}
\end_inset
the drive
\begin_inset LatexCommand \index{drive}
\end_inset
(see below,
\begin_inset LatexCommand \ref{mounting-and-unmounting}
\end_inset
for an example).
\layout Description
\noindent
umount
\begin_inset LatexCommand \index{umount}
\end_inset
'Unmount' a device.
\begin_inset LatexCommand \index{device}
\end_inset
The command
\begin_inset LatexCommand \index{command}
\end_inset
\emph on
umount
\emph default
(no 'n') unmount's a device.
\begin_inset LatexCommand \index{device}
\end_inset
It removes
\begin_inset LatexCommand \index{removes}
\end_inset
it from the file-system
\begin_inset LatexCommand \index{file-system}
\end_inset
hierarchy
\begin_inset LatexCommand \index{hierarchy}
\end_inset
(the tree
\begin_inset LatexCommand \index{tree}
\end_inset
( / )).
This needs to be done before you remove
\begin_inset LatexCommand \index{remove}
\end_inset
a floppy/CDROM or any other removable
\begin_inset LatexCommand \index{removable}
\end_inset
device
\begin_inset LatexCommand \index{device}
\end_inset
(see below,
\begin_inset LatexCommand \ref{mounting-and-unmounting}
\end_inset
for an example).
\layout Description
smbmount\SpecialChar ~
//wincomp/c\SpecialChar ~
/mnt/win Where
\begin_inset Quotes eld
\end_inset
win
\begin_inset Quotes erd
\end_inset
would be the place
\begin_inset LatexCommand \index{place}
\end_inset
you want it mounted
\begin_inset LatexCommand \index{mounted}
\end_inset
and
\begin_inset Quotes eld
\end_inset
wincomp
\begin_inset Quotes erd
\end_inset
is the IP
\begin_inset LatexCommand \index{IP}
\end_inset
address or name (the name will only work
\begin_inset LatexCommand \index{work}
\end_inset
if it's listed
\begin_inset LatexCommand \index{listed}
\end_inset
in /etc/hosts) of your windows
\begin_inset LatexCommand \index{windows}
\end_inset
computer.
\begin_inset LatexCommand \index{computer}
\end_inset
\emph on
smbmount
\emph default
is a tool
\begin_inset LatexCommand \index{tool}
\end_inset
from the samba
\begin_inset LatexCommand \index{samba}
\end_inset
package, it can mount
\begin_inset LatexCommand \index{mount}
\end_inset
a remote
\begin_inset LatexCommand \index{remote}
\end_inset
windows
\begin_inset LatexCommand \index{windows}
\end_inset
file system
\begin_inset LatexCommand \index{system}
\end_inset
onto your current
\begin_inset LatexCommand \index{current}
\end_inset
computer.
\begin_inset LatexCommand \index{computer}
\end_inset
\begin_deeper
\layout Standard
Un-mounting uses the same syntax
\begin_inset LatexCommand \index{syntax}
\end_inset
as 'umount', as listed
\begin_inset LatexCommand \index{listed}
\end_inset
above, or you may like to use:
\layout Code
smbumont /mountpoint
\layout Standard
Examples
\begin_inset LatexCommand \index{Examples}
\end_inset
of how to mount
\begin_inset LatexCommand \index{mount}
\end_inset
a file-system:
\begin_inset LatexCommand \index{file-system}
\end_inset
\layout SGML
\layout SGML
mount -t ext2 /dev/fd0 /mnt/floppy
\series bold
\series default
\layout SGML
mount -t iso9660 /dev/hdb /mnt/cdrom
\layout SGML
mount -t iso /tmp/image_file /mnt/iso_file/ -o loop
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
The windows filesystem is known as vfat (standard on Windows 9x) or NFTS
(standard on Windows 2000 and XP).
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
for CDROM's
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
This will mount an image file (usually a CD image file) so you can view/chang
e the files (it will appear to be like any other device).
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
The -t option
\layout SGML
\layout SGML
On any system running a newer version of the Linux kernel the
\emph on
-t
\emph default
option is not always necessary and can be left out.
\layout SGML
\layout SGML
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
above is kernel dependent
\end_inset
\layout Standard
\noindent
Examples
\begin_inset LatexCommand \index{Examples}
\end_inset
of how to unmount
\begin_inset LatexCommand \index{unmount}
\end_inset
a file-system
\begin_inset LatexCommand \index{file-system}
\end_inset
(necessary before you eject/remove disk):
\layout Code
\noindent
umount /mount_point
\layout Standard
An example
\begin_inset LatexCommand \index{example}
\end_inset
unmount point could be
\begin_inset Quotes eld
\end_inset
/mnt/floppy
\begin_inset Quotes erd
\end_inset
or
\begin_inset Quotes eld
\end_inset
/mnt/cdrom
\begin_inset Quotes erd
\end_inset
\end_deeper
\layout Section
Shutting Down/Rebooting the System
\begin_inset LatexCommand \label{shutting-down}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
add poweroff? its usually called by shutdown -h or halt\SpecialChar \ldots{}
\end_inset
\layout Description
shutdown\SpecialChar ~
now Shutdown
\begin_inset LatexCommand \index{Shutdown}
\end_inset
the computer
\begin_inset LatexCommand \index{computer}
\end_inset
immediately (don't power
\begin_inset LatexCommand \index{power}
\end_inset
down).
Note that in UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
systems this kind
\begin_inset LatexCommand \index{kind}
\end_inset
of shutdown
\begin_inset LatexCommand \index{shutdown}
\end_inset
means to go to
\begin_inset Quotes eld
\end_inset
single-user
\begin_inset LatexCommand \index{single-user}
\end_inset
mode
\begin_inset LatexCommand \index{mode}
\end_inset
\begin_inset Quotes erd
\end_inset
.
Single user
\begin_inset LatexCommand \index{user}
\end_inset
mode is a mode
\begin_inset LatexCommand \index{mode}
\end_inset
where only the administrator
\begin_inset LatexCommand \index{administrator}
\end_inset
(root) has access
\begin_inset LatexCommand \index{access}
\end_inset
to the computer,
\begin_inset LatexCommand \index{computer}
\end_inset
this mode
\begin_inset LatexCommand \index{mode}
\end_inset
is designed
\begin_inset LatexCommand \index{designed}
\end_inset
for maintenance
\begin_inset LatexCommand \index{maintenance}
\end_inset
and is often used for repairs.
\begin_inset LatexCommand \index{repairs}
\end_inset
\begin_deeper
\layout Standard
For example
\begin_inset LatexCommand \index{example}
\end_inset
this would take
\begin_inset LatexCommand \index{take}
\end_inset
you to single user
\begin_inset LatexCommand \index{user}
\end_inset
mode
\layout Code
shutdown now
\end_deeper
\layout Description
shutdown\SpecialChar ~
-h\SpecialChar ~
now Shutdown
\begin_inset LatexCommand \index{Shutdown}
\end_inset
\emph on
(-h = halt)
\emph default
the computer
\begin_inset LatexCommand \index{computer}
\end_inset
immediately.
It begins the shutdown
\begin_inset LatexCommand \index{shutdown}
\end_inset
procedure,
\begin_inset LatexCommand \index{procedure}
\end_inset
press
\begin_inset LatexCommand \index{press}
\end_inset
CTRL-C (break-key) to stop
\begin_inset LatexCommand \index{stop}
\end_inset
it.
After the end
\begin_inset LatexCommand \index{end}
\end_inset
of the command
\begin_inset LatexCommand \index{command}
\end_inset
you can also leave a message
\begin_inset LatexCommand \index{message}
\end_inset
in quotation
\begin_inset LatexCommand \index{quotation}
\end_inset
marks
\begin_inset LatexCommand \index{marks}
\end_inset
which will be broad-casted
\begin_inset LatexCommand \index{broad-casted}
\end_inset
to all users,
\begin_inset LatexCommand \index{users}
\end_inset
for example:
\begin_inset LatexCommand \index{example}
\end_inset
\begin_deeper
\layout Code
shutdown -h now "Warning system malfunction, self-destruct imminent"
\layout Standard
This would halt
\begin_inset LatexCommand \index{halt}
\end_inset
the system
\begin_inset LatexCommand \index{system}
\end_inset
and send
\begin_inset LatexCommand \index{send}
\end_inset
the message
\begin_inset LatexCommand \index{message}
\end_inset
to anyone who was logged
\begin_inset LatexCommand \index{logged}
\end_inset
in.
\layout Standard
Note you can put a time
\begin_inset LatexCommand \index{time}
\end_inset
instead of
\begin_inset Quotes eld
\end_inset
now
\begin_inset Quotes erd
\end_inset
or
\begin_inset Quotes eld
\end_inset
+x minutes
\begin_inset LatexCommand \index{minutes}
\end_inset
\begin_inset Quotes erd
\end_inset
(any number
\begin_inset LatexCommand \index{number}
\end_inset
of minutes
\begin_inset LatexCommand \index{minutes}
\end_inset
is appropriate) or you can set
\begin_inset LatexCommand \index{set}
\end_inset
an exact
\begin_inset LatexCommand \index{exact}
\end_inset
time.
For example
\begin_inset LatexCommand \index{example}
\end_inset
to shutdown
\begin_inset LatexCommand \index{shutdown}
\end_inset
at 11:50 type:
\layout Code
shutdown -h 11:50
\layout SGML
\layout SGML
Shutdown -h vs poweroff
\layout SGML
On some systems,
\emph on
shutdown -h
\emph default
and
\emph on
halt
\emph default
do not actually poweroff the system.
On systems that do not power off with these commands use the
\emph on
poweroff
\emph default
command
\layout SGML
\end_deeper
\layout Description
halt
\begin_inset LatexCommand \index{halt}
\end_inset
Same as above, doesn't take
\begin_inset LatexCommand \index{take}
\end_inset
any options,
\begin_inset LatexCommand \index{options}
\end_inset
just shuts down immediately.
\layout Description
\noindent
shutdown\SpecialChar ~
-r\SpecialChar ~
now Shutdown
\begin_inset LatexCommand \index{Shutdown}
\end_inset
(
\emph on
-r
\begin_inset LatexCommand \index{-r}
\end_inset
= reboot
\begin_inset LatexCommand \index{reboot}
\end_inset
\emph default
) the computer
\begin_inset LatexCommand \index{computer}
\end_inset
immediately.
It begins the reboot
\begin_inset LatexCommand \index{reboot}
\end_inset
procedure,
\begin_inset LatexCommand \index{procedure}
\end_inset
press
\begin_inset LatexCommand \index{press}
\end_inset
CTRL-C (break-key) to stop
\begin_inset LatexCommand \index{stop}
\end_inset
it.
After the end
\begin_inset LatexCommand \index{end}
\end_inset
of the command
\begin_inset LatexCommand \index{command}
\end_inset
you can also leave a message
\begin_inset LatexCommand \index{message}
\end_inset
in quotation
\begin_inset LatexCommand \index{quotation}
\end_inset
marks
\begin_inset LatexCommand \index{marks}
\end_inset
which will be broad-casted
\begin_inset LatexCommand \index{broad-casted}
\end_inset
to all users,
\begin_inset LatexCommand \index{users}
\end_inset
for example:
\begin_inset LatexCommand \index{example}
\end_inset
\begin_deeper
\layout Code
\noindent
shutdown -r now "Warning system rebooting, all files will be destroyed"
\layout Standard
\noindent
This would reboot
\begin_inset LatexCommand \index{reboot}
\end_inset
the system
\begin_inset LatexCommand \index{system}
\end_inset
and send
\begin_inset LatexCommand \index{send}
\end_inset
the message
\begin_inset LatexCommand \index{message}
\end_inset
to anyone who was logged
\begin_inset LatexCommand \index{logged}
\end_inset
in.
\layout Standard
Note you can put a time
\begin_inset LatexCommand \index{time}
\end_inset
instead of
\begin_inset Quotes eld
\end_inset
now
\begin_inset Quotes erd
\end_inset
or
\begin_inset Quotes eld
\end_inset
+x minutes
\begin_inset LatexCommand \index{minutes}
\end_inset
\begin_inset Quotes erd
\end_inset
(any number
\begin_inset LatexCommand \index{number}
\end_inset
of minutes
\begin_inset LatexCommand \index{minutes}
\end_inset
is appropriate) or you can set
\begin_inset LatexCommand \index{set}
\end_inset
an exact
\begin_inset LatexCommand \index{exact}
\end_inset
time.
For example
\begin_inset LatexCommand \index{example}
\end_inset
to reboot
\begin_inset LatexCommand \index{reboot}
\end_inset
at 11:50 type:
\layout Code
shutdown -r 11:50
\end_deeper
\layout Description
\noindent
reboot
\begin_inset LatexCommand \index{reboot}
\end_inset
Same as above, doesn't take
\begin_inset LatexCommand \index{take}
\end_inset
any options,
\begin_inset LatexCommand \index{options}
\end_inset
reboots
\begin_inset LatexCommand \index{reboots}
\end_inset
immediately.
\layout Description
\noindent
CTRL-ALT-DEL (key-combination) May be used from a terminal
\begin_inset LatexCommand \index{terminal}
\end_inset
to reboot
\begin_inset LatexCommand \index{reboot}
\end_inset
or shutdown,
\begin_inset LatexCommand \index{shutdown}
\end_inset
it depends on your system
\begin_inset LatexCommand \index{system}
\end_inset
configuration.
Note that this doesn't work
\begin_inset LatexCommand \index{work}
\end_inset
from an xterminal.
\begin_inset LatexCommand \index{xterminal}
\end_inset
CTRL-ALT-DEL begins the reboot/shutdown immediately, the user
\begin_inset LatexCommand \index{user}
\end_inset
does not have to be logged
\begin_inset LatexCommand \index{logged}
\end_inset
in.
\begin_deeper
\layout SGML
\layout SGML
You can change the behaviour of CTRL-ALT-DEL from rebooting
\layout SGML
\layout SGML
To disable CTRL-ALT-DEL from rebooting your computer (or to have it do something
different), you can edit the /etc/inittab file (as root).
\layout SGML
\layout SGML
\layout SGML
Here is how it looks on a Mandrake/Mandriva Linux system:
\layout SGML
\layout SGML
# Trap CTRL-ALT-DEL
\layout SGML
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
\layout SGML
\layout SGML
\layout SGML
\layout SGML
Note that the # means a comment (and is not used).
If you simply put a # (hash) before the command it would disable it (it
would become a comment).
\layout SGML
\layout SGML
\layout SGML
You could also change the command it runs for example if you changed the
\emph on
-r
\emph default
to a
\emph on
-h
\emph default
the computer would turn off instead of rebooting, or you could have it do
anything you want.
It's up to your creativity to make it do something interesting.
\layout SGML
\layout SGML
\end_deeper
\layout Section
Controlling Processes
\begin_inset LatexCommand \label{controlling-processes}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
should this be kept? because I'm sure 90% of users use bash only\SpecialChar \ldots{}
\layout Description
nohup (no-hangup).
Stops a particular process from being stopped by the user logging out,
because if you start a process and logout, some shells will stop the process
(BASH, by default doesn't do this).
\begin_deeper
\layout Description
Command syntax:
\layout Code
nohup command_to_be_protected
\end_deeper
\layout Standard
(too oldschool):
\layout Description
sync
\emph on
sync
\emph default
forces all things in buffers to be put to disk.
\end_inset
\layout Description
ps
\begin_inset LatexCommand \index{ps}
\end_inset
Will give you a list
\begin_inset LatexCommand \index{list}
\end_inset
of the processes
\begin_inset LatexCommand \index{processes}
\end_inset
running on your system.
\begin_inset LatexCommand \index{system}
\end_inset
With no options,
\begin_inset LatexCommand \index{options}
\end_inset
\emph on
ps
\emph default
will list
\begin_inset LatexCommand \index{list}
\end_inset
processes
\begin_inset LatexCommand \index{processes}
\end_inset
that belong to the current
\begin_inset LatexCommand \index{current}
\end_inset
user
\begin_inset LatexCommand \index{user}
\end_inset
and have a controlling
\begin_inset LatexCommand \index{controlling}
\end_inset
terminal.
\begin_inset LatexCommand \index{terminal}
\end_inset
\begin_deeper
\layout Standard
Example
\begin_inset LatexCommand \index{Example}
\end_inset
options
\begin_inset LatexCommand \index{options}
\end_inset
include:
\layout Itemize
\emph on
-aux
\emph default
--- list
\begin_inset LatexCommand \index{list}
\end_inset
all running
\begin_inset LatexCommand \index{running}
\end_inset
processes
\begin_inset LatexCommand \index{processes}
\end_inset
(by all users
\begin_inset LatexCommand \index{users}
\end_inset
with some information).
\layout Itemize
\emph on
-a
\emph default
--- list
\begin_inset LatexCommand \index{list}
\end_inset
all processes
\begin_inset LatexCommand \index{processes}
\end_inset
from all users.
\begin_inset LatexCommand \index{users}
\end_inset
\layout Itemize
\emph on
-u
\emph default
--- list
\begin_inset LatexCommand \index{list}
\end_inset
more information
\begin_inset LatexCommand \index{information}
\end_inset
including user
\begin_inset LatexCommand \index{user}
\end_inset
names, %cpu
\begin_inset LatexCommand \index{%cpu}
\end_inset
usage, and %mem
\begin_inset LatexCommand \index{%mem}
\end_inset
usage et cetera.
\begin_inset LatexCommand \index{cetera}
\end_inset
\layout Itemize
\emph on
-x
\emph default
--- list
\begin_inset LatexCommand \index{list}
\end_inset
processes
\begin_inset LatexCommand \index{processes}
\end_inset
without controlling
\begin_inset LatexCommand \index{controlling}
\end_inset
terminals.
\layout Itemize
\emph on
-l
\emph default
--- display
\begin_inset LatexCommand \index{display}
\end_inset
different information
\begin_inset LatexCommand \index{information}
\end_inset
including UID
\begin_inset LatexCommand \index{UID}
\end_inset
and nice
\begin_inset LatexCommand \index{nice}
\end_inset
value.
\begin_inset LatexCommand \index{value}
\end_inset
\layout Itemize
\emph on
--forest
\emph default
--- this makes it easier to see the process
\begin_inset LatexCommand \index{process}
\end_inset
hierarchy,
\begin_inset LatexCommand \index{hierarchy}
\end_inset
which
\begin_inset LatexCommand \index{which}
\end_inset
will give you an indication
\begin_inset LatexCommand \index{indication}
\end_inset
of how the various processes
\begin_inset LatexCommand \index{processes}
\end_inset
on your system
\begin_inset LatexCommand \index{system}
\end_inset
interrelate
\begin_inset LatexCommand \index{interrelate}
\end_inset
(although you should also try
\begin_inset LatexCommand \index{try}
\end_inset
\emph on
pstree
\emph default
).
\layout Standard
For example
\begin_inset LatexCommand \index{example}
\end_inset
to list
\begin_inset LatexCommand \index{list}
\end_inset
all running
\begin_inset LatexCommand \index{running}
\end_inset
processes
\begin_inset LatexCommand \index{processes}
\end_inset
with additional
\begin_inset LatexCommand \index{additional}
\end_inset
information,
\begin_inset LatexCommand \index{information}
\end_inset
simply type:
\layout Code
ps -aux
\end_deeper
\layout Description
pstree
\begin_inset LatexCommand \index{pstree}
\end_inset
Displays the processes
\begin_inset LatexCommand \index{processes}
\end_inset
in the form
\begin_inset LatexCommand \index{form}
\end_inset
of a tree
\begin_inset LatexCommand \index{tree}
\end_inset
structure (similar to how
\emph on
tree
\emph default
does it for directories).
\begin_deeper
\layout Standard
Use the
\emph on
-p
\begin_inset LatexCommand \index{-p}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to show
\begin_inset LatexCommand \index{show}
\end_inset
process id's.
\begin_inset LatexCommand \index{id's}
\end_inset
\layout Standard
Example:
\layout Code
pstree -p
\layout Standard
This would list
\begin_inset LatexCommand \index{list}
\end_inset
all processes
\begin_inset LatexCommand \index{processes}
\end_inset
and their ids.
\begin_inset LatexCommand \index{ids}
\end_inset
\end_deeper
\layout Description
pgrep
\begin_inset LatexCommand \index{pgrep}
\end_inset
This command
\begin_inset LatexCommand \index{command}
\end_inset
is useful for finding
\begin_inset LatexCommand \index{finding}
\end_inset
the process
\begin_inset LatexCommand \index{process}
\end_inset
id
\begin_inset LatexCommand \index{id}
\end_inset
of a particular
\begin_inset LatexCommand \index{particular}
\end_inset
process
\begin_inset LatexCommand \index{process}
\end_inset
when you know part
\begin_inset LatexCommand \index{part}
\end_inset
of its name.
\begin_deeper
\layout Standard
Use the
\emph on
-l
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to list
\begin_inset LatexCommand \index{list}
\end_inset
the name of the process
\begin_inset LatexCommand \index{process}
\end_inset
as well and the
\emph on
-u
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to search
\begin_inset LatexCommand \index{search}
\end_inset
via a particular
\begin_inset LatexCommand \index{particular}
\end_inset
user(s).
\layout Standard
Normally
\emph on
pgrep
\emph default
will only return
\begin_inset LatexCommand \index{return}
\end_inset
the pid
\begin_inset LatexCommand \index{pid}
\end_inset
number; this way you can use it with other commands.
\begin_inset LatexCommand \index{commands}
\end_inset
\layout Standard
Examples:
\layout Code
kill $(pgrep mozilla)
\layout Standard
This would kill
\begin_inset LatexCommand \index{kill}
\end_inset
any process
\begin_inset LatexCommand \index{process}
\end_inset
name that starts
\begin_inset LatexCommand \index{starts}
\end_inset
with mozilla.
\begin_inset LatexCommand \index{mozilla}
\end_inset
Note that this is the same as using
\emph on
pkill
\emph default
(see below).
\layout Standard
If you are unfamiliar
\begin_inset LatexCommand \index{unfamiliar}
\end_inset
with the
\emph on
$(\SpecialChar ~
)
\emph default
part
\begin_inset LatexCommand \index{part}
\end_inset
of this command,
\begin_inset LatexCommand \index{command}
\end_inset
please refer
\begin_inset LatexCommand \index{refer}
\end_inset
to
\begin_inset LatexCommand \ref{performing-more-than-one-command}
\end_inset
.
\layout Standard
To list
\begin_inset LatexCommand \index{list}
\end_inset
processes
\begin_inset LatexCommand \index{processes}
\end_inset
id's and names type:
\layout Code
pgrep -l process_name
\end_deeper
\layout Description
top
\begin_inset LatexCommand \index{top}
\end_inset
Displays the 'top' (as in CPU
\begin_inset LatexCommand \index{CPU}
\end_inset
usage) processes,
\begin_inset LatexCommand \index{processes}
\end_inset
provides
\begin_inset LatexCommand \index{provides}
\end_inset
more detail
\begin_inset LatexCommand \index{detail}
\end_inset
than
\emph on
ps
\emph default
.
\begin_deeper
\layout Standard
\emph on
top
\emph default
also provides
\begin_inset LatexCommand \index{provides}
\end_inset
an updated
\begin_inset LatexCommand \index{updated}
\end_inset
display, it has many option
\begin_inset LatexCommand \index{option}
\end_inset
that make it fully customisable,
\begin_inset LatexCommand \index{customisable}
\end_inset
refer
\begin_inset LatexCommand \index{refer}
\end_inset
to the manual
\begin_inset LatexCommand \index{manual}
\end_inset
or info
\begin_inset LatexCommand \index{info}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
for details.
\begin_inset LatexCommand \index{details}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
does someone want to explain the options? I don't know how to use
\emph on
top
\emph default
\SpecialChar \ldots{}
\end_inset
\end_deeper
\layout Description
kill To kill
\begin_inset LatexCommand \index{kill}
\end_inset
processes
\begin_inset LatexCommand \index{processes}
\end_inset
on your system,
\begin_inset LatexCommand \index{system}
\end_inset
you will need their pid's or id's
\begin_inset LatexCommand \index{id's}
\end_inset
.
Use
\emph on
ps
\emph default
or
\emph on
pstree
\emph default
to find
\begin_inset LatexCommand \index{find}
\end_inset
out the process
\begin_inset LatexCommand \index{process}
\end_inset
id's
\begin_inset LatexCommand \index{id's}
\end_inset
(pids), or use
\emph on
jobs
\emph default
to find
\begin_inset LatexCommand \index{find}
\end_inset
out id's.
\begin_inset LatexCommand \index{id's}
\end_inset
\begin_deeper
\layout SGML
\layout SGML
killall and pkill - kill a process by name
\layout SGML
\emph on
pkill
\emph default
and
\emph on
killall
\emph default
can be a lot easier to use than
\emph on
kill
\emph default
.
\emph on
pkill
\emph default
allows you to type part of the name of a process to kill it, while
\emph on
killall
\emph default
requires the full process name.
See below for more information.
\layout SGML
\layout Standard
Examples:
\layout Code
kill pid
\layout Standard
Simply kill
\begin_inset LatexCommand \index{kill}
\end_inset
a process
\begin_inset LatexCommand \index{process}
\end_inset
(allow it time
\begin_inset LatexCommand \index{time}
\end_inset
to save
\begin_inset LatexCommand \index{save}
\end_inset
it's files
\begin_inset LatexCommand \index{files}
\end_inset
and exit)
\layout Code
kill %id
\layout Standard
Same as above, except it uses an id
\begin_inset LatexCommand \index{id}
\end_inset
instead of a pid,
\begin_inset LatexCommand \index{pid}
\end_inset
you need to use a % (percent) when using an id
\begin_inset LatexCommand \index{id}
\end_inset
to kill.
\begin_inset LatexCommand \index{kill}
\end_inset
\layout Code
kill -kill pid
\layout Standard
Force
\begin_inset LatexCommand \index{Force}
\end_inset
a process
\begin_inset LatexCommand \index{process}
\end_inset
to be killed
\begin_inset LatexCommand \index{killed}
\end_inset
(won't allow
\begin_inset LatexCommand \index{allow}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
to be saved
\begin_inset LatexCommand \index{saved}
\end_inset
or updated); only use when necessary because all data
\begin_inset LatexCommand \index{data}
\end_inset
that the program
\begin_inset LatexCommand \index{program}
\end_inset
had will be lost.
\begin_inset LatexCommand \index{lost}
\end_inset
\layout Standard
There are also many other kill
\begin_inset LatexCommand \index{kill}
\end_inset
options
\begin_inset LatexCommand \index{options}
\end_inset
such as kill
\begin_inset LatexCommand \index{kill}
\end_inset
-HUP
\begin_inset LatexCommand \index{-HUP}
\end_inset
\emph on
\emph default
(hangup)
\emph on
\SpecialChar \ldots{}
\emph default
refer
\begin_inset LatexCommand \index{refer}
\end_inset
to the manual/info pages
\begin_inset LatexCommand \index{pages}
\end_inset
for more
\begin_inset LatexCommand \index{more}
\end_inset
information.
\begin_inset LatexCommand \index{information}
\end_inset
\end_deeper
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
personally I think removing kill and killall would be ok, but that may offend
some people\SpecialChar \ldots{}
\end_inset
\layout Description
killall
\begin_inset LatexCommand \index{killall}
\end_inset
Kill a process
\begin_inset LatexCommand \index{process}
\end_inset
by it's name, uses names instead of process
\begin_inset LatexCommand \index{process}
\end_inset
id's
\begin_inset LatexCommand \index{id's}
\end_inset
(pids).
Use
\emph on
-v
\begin_inset LatexCommand \index{-v}
\end_inset
\emph default
to have
\emph on
killall
\emph default
report
\begin_inset LatexCommand \index{report}
\end_inset
whether the kill
\begin_inset LatexCommand \index{kill}
\end_inset
was successful
\begin_inset LatexCommand \index{successful}
\end_inset
or not and
\emph on
-i
\begin_inset LatexCommand \index{-i}
\end_inset
\emph default
for interactive
\begin_inset LatexCommand \index{interactive}
\end_inset
mode (will prompt
\begin_inset LatexCommand \index{prompt}
\end_inset
you before attempting
\begin_inset LatexCommand \index{attempting}
\end_inset
to kill).
\begin_deeper
\layout SGML
\layout SGML
pkill - a little like a killall with regular expressions
\layout SGML
pkill is another command that allows processes to be killed but does
so using regular expressions.
See below for more information.
\layout SGML
\layout Standard
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
killall -iv mozilla
\layout Standard
Would kill
\begin_inset LatexCommand \index{kill}
\end_inset
anything named
\begin_inset LatexCommand \index{named}
\end_inset
\begin_inset Quotes eld
\end_inset
mozilla
\begin_inset Quotes erd
\end_inset
and prompt
\begin_inset LatexCommand \index{prompt}
\end_inset
you before each kill
\begin_inset LatexCommand \index{kill}
\end_inset
and report
\begin_inset LatexCommand \index{report}
\end_inset
whether the kill
\begin_inset LatexCommand \index{kill}
\end_inset
was successful
\begin_inset LatexCommand \index{successful}
\end_inset
or not.
Unfortunately
\begin_inset LatexCommand \index{Unfortunately}
\end_inset
you need to get the name exactly
\begin_inset LatexCommand \index{exactly}
\end_inset
right for
\emph on
killall
\emph default
to work,
\begin_inset LatexCommand \index{work}
\end_inset
you would need to use
\begin_inset Quotes eld
\end_inset
mozilla-bin
\begin_inset Quotes erd
\end_inset
to kill
\begin_inset LatexCommand \index{kill}
\end_inset
the mozilla
\begin_inset LatexCommand \index{mozilla}
\end_inset
browser.
If you want something where you don't need to know the exact
\begin_inset LatexCommand \index{exact}
\end_inset
name try
\begin_inset LatexCommand \index{try}
\end_inset
\emph on
pkill
\begin_inset LatexCommand \index{pkill}
\end_inset
\emph default
(below).
\end_deeper
\layout Description
pkill
\begin_inset LatexCommand \index{pkill}
\end_inset
\emph on
pkill
\emph default
is used to kill
\begin_inset LatexCommand \index{kill}
\end_inset
processes
\begin_inset LatexCommand \index{processes}
\end_inset
according to an extended
\begin_inset LatexCommand \index{extended}
\end_inset
regular
\begin_inset LatexCommand \index{regular}
\end_inset
expression.
Use the
\emph on
-u
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to kill
\begin_inset LatexCommand \index{kill}
\end_inset
using a user
\begin_inset LatexCommand \index{user}
\end_inset
name(s) and process
\begin_inset LatexCommand \index{process}
\end_inset
name (for example
\begin_inset LatexCommand \index{example}
\end_inset
to only kill
\begin_inset LatexCommand \index{kill}
\end_inset
a process
\begin_inset LatexCommand \index{process}
\end_inset
of a certain user).
\emph on
pkill
\emph default
can also send
\begin_inset LatexCommand \index{send}
\end_inset
specific signals
\begin_inset LatexCommand \index{signals}
\end_inset
to processes.
\begin_inset LatexCommand \index{processes}
\end_inset
\begin_deeper
\layout Standard
For normal
\begin_inset LatexCommand \index{normal}
\end_inset
usage simply type:
\layout Code
pkill process_name
\layout Standard
Note that the
\begin_inset Quotes eld
\end_inset
process_name
\begin_inset Quotes erd
\end_inset
doesn't have to be an exact match\SpecialChar \ldots{}
\layout Standard
Or to kill
\begin_inset LatexCommand \index{kill}
\end_inset
the
\begin_inset Quotes eld
\end_inset
process_name
\begin_inset Quotes erd
\end_inset
of only the users
\begin_inset LatexCommand \index{users}
\end_inset
\begin_inset Quotes eld
\end_inset
fred
\begin_inset Quotes erd
\end_inset
and
\begin_inset Quotes eld
\end_inset
anon
\begin_inset Quotes erd
\end_inset
type:
\layout Code
pkill -u fred anon process_name
\end_deeper
\layout Description
skill
\begin_inset LatexCommand \index{skill}
\end_inset
\emph on
skill
\emph default
is used to send
\begin_inset LatexCommand \index{send}
\end_inset
a command/username/tty a particular
\begin_inset LatexCommand \index{particular}
\end_inset
signal.
\begin_inset LatexCommand \index{signal}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
skill and snice do not use regular expressions (tested!!!!)
\end_inset
\begin_deeper
\layout Standard
\emph on
skill
\emph default
has a number
\begin_inset LatexCommand \index{number}
\end_inset
of options
\begin_inset LatexCommand \index{options}
\end_inset
available
\begin_inset LatexCommand \index{available}
\end_inset
to ensure
\begin_inset LatexCommand \index{ensure}
\end_inset
correct
\begin_inset LatexCommand \index{correct}
\end_inset
interpretation (otherwise it just guesses
\begin_inset LatexCommand \index{guesses}
\end_inset
what it is), simply type
\emph on
skill
\begin_inset LatexCommand \index{skill}
\end_inset
-option(s)
\layout Itemize
\emph on
-L
\emph default
--- list
\begin_inset LatexCommand \index{list}
\end_inset
the various signals
\begin_inset LatexCommand \index{signals}
\end_inset
that can be sent
\layout Itemize
\emph on
-u
\emph default
--- specify
\begin_inset LatexCommand \index{specify}
\end_inset
a username;
\begin_inset LatexCommand \index{username}
\end_inset
this is obviously followed
\begin_inset LatexCommand \index{followed}
\end_inset
by the user
\begin_inset LatexCommand \index{user}
\end_inset
name or a space-seperated
\begin_inset LatexCommand \index{space-seperated}
\end_inset
list
\begin_inset LatexCommand \index{list}
\end_inset
of usernames.
\begin_inset LatexCommand \index{usernames}
\end_inset
\layout Itemize
\emph on
-p
\emph default
--- process
\begin_inset LatexCommand \index{process}
\end_inset
id
\begin_inset LatexCommand \index{id}
\end_inset
(followed by the process
\begin_inset LatexCommand \index{process}
\end_inset
id)
\layout Itemize
\emph on
-c
\emph default
--- command
\begin_inset LatexCommand \index{command}
\end_inset
name (this is the same as
\emph on
killall
\emph default
)
\layout Itemize
\emph on
-t
\emph default
--- (tty number)
\layout Itemize
\emph on
-v
\emph default
--- verbose
\begin_inset LatexCommand \index{verbose}
\end_inset
mode
\begin_inset LatexCommand \index{mode}
\end_inset
\layout Itemize
\emph on
-i
\emph default
--- interactive
\begin_inset LatexCommand \index{interactive}
\end_inset
mode.
\layout Standard
\emph on
skill
\emph default
can be used to stop,
\begin_inset LatexCommand \index{stop}
\end_inset
continue, or kill
\begin_inset LatexCommand \index{kill}
\end_inset
processes
\begin_inset LatexCommand \index{processes}
\end_inset
using the username,
\begin_inset LatexCommand \index{username}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
name or process
\begin_inset LatexCommand \index{process}
\end_inset
id
\begin_inset LatexCommand \index{id}
\end_inset
(or send
\begin_inset LatexCommand \index{send}
\end_inset
them any variety
\begin_inset LatexCommand \index{variety}
\end_inset
of signals
\begin_inset LatexCommand \index{signals}
\end_inset
you like).
\layout Standard
Useful example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
skill -STOP abusive_user_name
\layout Standard
The above command
\begin_inset LatexCommand \index{command}
\end_inset
will stop
\begin_inset LatexCommand \index{stop}
\end_inset
all of that users
\begin_inset LatexCommand \index{users}
\end_inset
processes,
\begin_inset LatexCommand \index{processes}
\end_inset
this will cause
\begin_inset LatexCommand \index{cause}
\end_inset
his screen
\begin_inset LatexCommand \index{screen}
\end_inset
to freeze
\begin_inset LatexCommand \index{freeze}
\end_inset
until
\begin_inset LatexCommand \index{until}
\end_inset
you type:
\layout Code
skill -CONT abusive_user_name
\layout Standard
This would tell
\begin_inset LatexCommand \index{tell}
\end_inset
that all processes
\begin_inset LatexCommand \index{processes}
\end_inset
may continue as before.
Note that this would only work
\begin_inset LatexCommand \index{work}
\end_inset
if you are root.
\begin_inset LatexCommand \index{root}
\end_inset
Also note you can list
\begin_inset LatexCommand \index{list}
\end_inset
more than one user
\begin_inset LatexCommand \index{user}
\end_inset
name with the command
\begin_inset LatexCommand \index{command}
\end_inset
so it will apply
\begin_inset LatexCommand \index{apply}
\end_inset
to multiple
\begin_inset LatexCommand \index{multiple}
\end_inset
users.
\end_deeper
\layout Description
CTRL-C The break
\begin_inset LatexCommand \index{break}
\end_inset
key,
\begin_inset LatexCommand \index{key}
\end_inset
will kill
\begin_inset LatexCommand \index{kill}
\end_inset
(break, stop) something that's running
\begin_inset LatexCommand \index{running}
\end_inset
on your terminal.
\begin_inset LatexCommand \index{terminal}
\end_inset
\layout Description
jobs
\begin_inset LatexCommand \index{jobs}
\end_inset
Prints
\begin_inset LatexCommand \index{Prints}
\end_inset
currently running
\begin_inset LatexCommand \index{running}
\end_inset
jobs, as in processes
\begin_inset LatexCommand \index{processes}
\end_inset
you have executed within the shell.
\begin_inset LatexCommand \index{shell}
\end_inset
\layout Description
bg
\begin_inset LatexCommand \index{bg}
\end_inset
Backgrounds
\begin_inset LatexCommand \index{Backgrounds}
\end_inset
a process.
\begin_inset LatexCommand \index{process}
\end_inset
To start
\begin_inset LatexCommand \index{start}
\end_inset
a program
\begin_inset LatexCommand \index{program}
\end_inset
in the background
\begin_inset LatexCommand \index{background}
\end_inset
(so it doesn't take
\begin_inset LatexCommand \index{take}
\end_inset
over the terminal) use an
\begin_inset Quotes eld
\end_inset
&
\begin_inset Quotes erd
\end_inset
(ampersand) sign
\begin_inset LatexCommand \index{sign}
\end_inset
at the end
\begin_inset LatexCommand \index{end}
\end_inset
of the command.
\begin_inset LatexCommand \index{command}
\end_inset
You usually use CTRL-Z to suspend
\begin_inset LatexCommand \index{suspend}
\end_inset
something you are currently using.
You can simply use
\emph on
bg
\emph default
to resume in the background the last job suspended\SpecialChar \ldots{}
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
bg job_number
\layout Standard
or
\layout Code
bg job_name
\end_deeper
\layout Description
fg
\begin_inset LatexCommand \index{fg}
\end_inset
Bring a process
\begin_inset LatexCommand \index{process}
\end_inset
to the foreground,
\begin_inset LatexCommand \index{foreground}
\end_inset
so you can interact
\begin_inset LatexCommand \index{interact}
\end_inset
with it.
The process
\begin_inset LatexCommand \index{process}
\end_inset
will use your current
\begin_inset LatexCommand \index{current}
\end_inset
terminal.
\begin_inset LatexCommand \index{terminal}
\end_inset
Note simply use
\emph on
fg
\emph default
to foreground the last job number suspended\SpecialChar \ldots{}
\begin_deeper
\layout Standard
You can bring jobs
\begin_inset LatexCommand \index{jobs}
\end_inset
to the foreground
\begin_inset LatexCommand \index{foreground}
\end_inset
by name or by number
\begin_inset LatexCommand \index{number}
\end_inset
(use
\emph on
jobs
\emph default
to find
\begin_inset LatexCommand \index{find}
\end_inset
the number).
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
fg job_number
\layout Standard
or
\layout Code
fg job_name
\end_deeper
\layout Description
nice
\begin_inset LatexCommand \index{nice}
\end_inset
Sets
\begin_inset LatexCommand \index{Sets}
\end_inset
the priority
\begin_inset LatexCommand \index{priority}
\end_inset
for a process.
\begin_inset LatexCommand \index{process}
\end_inset
\emph on
nice
\begin_inset LatexCommand \index{nice}
\end_inset
-20
\emph default
is the maximum
\begin_inset LatexCommand \index{maximum}
\end_inset
priority
\begin_inset LatexCommand \index{priority}
\end_inset
(only administrative
\begin_inset LatexCommand \index{administrative}
\end_inset
users can assign
\begin_inset LatexCommand \index{assign}
\end_inset
negative priorities),
\emph on
nice
\begin_inset LatexCommand \index{nice}
\end_inset
20
\emph default
is the minimum
\begin_inset LatexCommand \index{minimum}
\end_inset
priority.
\begin_inset LatexCommand \index{priority}
\end_inset
You must
\begin_inset LatexCommand \index{must}
\end_inset
be root
\begin_inset LatexCommand \index{root}
\end_inset
to give a process
\begin_inset LatexCommand \index{process}
\end_inset
a higher
\begin_inset LatexCommand \index{higher}
\end_inset
priority, but you can always lower the priority of your own processes\SpecialChar \ldots{}
\begin_deeper
\layout Standard
Example:
\layout Code
nice -20 make
\layout Standard
Would execute
\begin_inset LatexCommand \index{execute}
\end_inset
\emph on
make
\emph default
and it would run
\begin_inset LatexCommand \index{run}
\end_inset
at maximum
\begin_inset LatexCommand \index{maximum}
\end_inset
priority.
\begin_inset LatexCommand \index{priority}
\end_inset
\end_deeper
\layout Description
renice
\begin_inset LatexCommand \index{renice}
\end_inset
Changes the priority
\begin_inset LatexCommand \index{priority}
\end_inset
of an existing
\begin_inset LatexCommand \index{existing}
\end_inset
command.
You may use the options
\begin_inset LatexCommand \index{options}
\end_inset
\emph on
-u
\emph default
to change
\begin_inset LatexCommand \index{change}
\end_inset
the priorities
\begin_inset LatexCommand \index{priorities}
\end_inset
of all processes
\begin_inset LatexCommand \index{processes}
\end_inset
for a particular
\begin_inset LatexCommand \index{particular}
\end_inset
user
\begin_inset LatexCommand \index{user}
\end_inset
name and
\emph on
-g
\emph default
to change
\begin_inset LatexCommand \index{change}
\end_inset
priorities for all processes
\begin_inset LatexCommand \index{processes}
\end_inset
of a particular
\begin_inset LatexCommand \index{particular}
\end_inset
group.
\begin_inset LatexCommand \index{group}
\end_inset
The default
\begin_inset LatexCommand \index{default}
\end_inset
is to change
\begin_inset LatexCommand \index{change}
\end_inset
via the process
\begin_inset LatexCommand \index{process}
\end_inset
id
\begin_inset LatexCommand \index{id}
\end_inset
number.
\begin_deeper
\layout Standard
Example:
\layout Code
renice +20 2222
\layout Standard
This would change
\begin_inset LatexCommand \index{change}
\end_inset
the priority
\begin_inset LatexCommand \index{priority}
\end_inset
of process
\begin_inset LatexCommand \index{process}
\end_inset
2222 to +20 (minimum priority).
\end_deeper
\layout Description
snice
\begin_inset LatexCommand \index{snice}
\end_inset
\emph on
snice
\emph default
works
\begin_inset LatexCommand \index{works}
\end_inset
very similarly
\begin_inset LatexCommand \index{similarly}
\end_inset
to
\emph on
skill
\emph default
, only it changes the priority
\begin_inset LatexCommand \index{priority}
\end_inset
of the process(es).
Its function
\begin_inset LatexCommand \index{function}
\end_inset
is similar
\begin_inset LatexCommand \index{similar}
\end_inset
to that of
\emph on
renice
\emph default
.
\begin_deeper
\layout Standard
To use options
\begin_inset LatexCommand \index{options}
\end_inset
(to ensure
\begin_inset LatexCommand \index{ensure}
\end_inset
correct
\begin_inset LatexCommand \index{correct}
\end_inset
interpretation) you simply type
\emph on
snice
\begin_inset LatexCommand \index{snice}
\end_inset
-option(s):
\layout Itemize
\emph on
-u
\emph default
--- specify
\begin_inset LatexCommand \index{specify}
\end_inset
a username;
\begin_inset LatexCommand \index{username}
\end_inset
this is obviously followed
\begin_inset LatexCommand \index{followed}
\end_inset
by the user
\begin_inset LatexCommand \index{user}
\end_inset
name or a space-seperated
\begin_inset LatexCommand \index{space-seperated}
\end_inset
list
\begin_inset LatexCommand \index{list}
\end_inset
of usernames.
\begin_inset LatexCommand \index{usernames}
\end_inset
\layout Itemize
\emph on
-p
\emph default
--- process
\begin_inset LatexCommand \index{process}
\end_inset
id
\begin_inset LatexCommand \index{id}
\end_inset
(followed by the process
\begin_inset LatexCommand \index{process}
\end_inset
id)
\layout Itemize
\emph on
-c
\emph default
--- command
\begin_inset LatexCommand \index{command}
\end_inset
name (this is the same as
\emph on
killall
\emph default
)
\layout Itemize
\emph on
-t
\emph default
--- (tty number)
\layout Itemize
\emph on
-v
\emph default
--- verbose
\begin_inset LatexCommand \index{verbose}
\end_inset
mode
\begin_inset LatexCommand \index{mode}
\end_inset
\layout Itemize
\emph on
-i
\emph default
--- interactive
\begin_inset LatexCommand \index{interactive}
\end_inset
mode.
\layout Standard
Example:
\layout Code
snice -10 -u root
\layout Standard
This would increase
\begin_inset LatexCommand \index{increase}
\end_inset
the priority
\begin_inset LatexCommand \index{priority}
\end_inset
of all root's processes.
\begin_inset LatexCommand \index{processes}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
does this command replace renice or is it just more useful or something?
it seems to have more functionality.
\end_inset
\end_deeper
\layout Section
Controlling services
\begin_inset LatexCommand \label{controlling-services}
\end_inset
\layout Description
Concept\SpecialChar ~
Definitions
\begin_inset LatexCommand \label{services-concept}
\end_inset
\begin_deeper
\layout Standard
UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
systems use scripts
\begin_inset LatexCommand \index{scripts}
\end_inset
to control
\begin_inset LatexCommand \index{control}
\end_inset
\begin_inset Quotes eld
\end_inset
daemons
\begin_inset Quotes erd
\end_inset
which
\begin_inset LatexCommand \index{which}
\end_inset
provide
\begin_inset LatexCommand \index{provide}
\end_inset
\begin_inset Quotes eld
\end_inset
services
\begin_inset Quotes erd
\end_inset
(for example
\begin_inset LatexCommand \index{example}
\end_inset
your sound
\begin_inset LatexCommand \index{sound}
\end_inset
output) to run
\begin_inset LatexCommand \index{run}
\end_inset
a UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system.
\begin_inset LatexCommand \index{system}
\end_inset
UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
systems consist of a variety
\begin_inset LatexCommand \index{variety}
\end_inset
of services
\begin_inset LatexCommand \index{services}
\end_inset
(daemons).
\layout Standard
A
\begin_inset Quotes eld
\end_inset
daemon
\begin_inset Quotes erd
\end_inset
is a system
\begin_inset LatexCommand \index{system}
\end_inset
process which
\begin_inset LatexCommand \index{which}
\end_inset
runs
\begin_inset LatexCommand \index{runs}
\end_inset
in the background
\begin_inset LatexCommand \index{background}
\end_inset
(zero interaction) performing
\begin_inset LatexCommand \index{performing}
\end_inset
a particular
\begin_inset LatexCommand \index{particular}
\end_inset
task.
\begin_inset LatexCommand \index{task}
\end_inset
\layout Standard
Daemons
\begin_inset LatexCommand \index{Daemons}
\end_inset
normally have a
\begin_inset Quotes eld
\end_inset
d
\begin_inset Quotes erd
\end_inset
on the end
\begin_inset LatexCommand \index{end}
\end_inset
of their name and either listen
\begin_inset LatexCommand \index{listen}
\end_inset
for certain events
\begin_inset LatexCommand \index{events}
\end_inset
or perform
\begin_inset LatexCommand \index{perform}
\end_inset
a system
\begin_inset LatexCommand \index{system}
\end_inset
task,
\begin_inset LatexCommand \index{task}
\end_inset
for example
\begin_inset LatexCommand \index{example}
\end_inset
\emph on
sshd
\emph default
listens
\begin_inset LatexCommand \index{listens}
\end_inset
for secure
\begin_inset LatexCommand \index{secure}
\end_inset
shell
\begin_inset LatexCommand \index{shell}
\end_inset
requests to the particular
\begin_inset LatexCommand \index{particular}
\end_inset
machine
\begin_inset LatexCommand \index{machine}
\end_inset
and handles
\begin_inset LatexCommand \index{handles}
\end_inset
them when they occur.
\begin_inset LatexCommand \index{occur}
\end_inset
\layout Standard
Daemons
\begin_inset LatexCommand \index{Daemons}
\end_inset
usually perform
\begin_inset LatexCommand \index{perform}
\end_inset
critical
\begin_inset LatexCommand \index{critical}
\end_inset
system tasks
\begin_inset LatexCommand \index{tasks}
\end_inset
such as control
\begin_inset LatexCommand \index{control}
\end_inset
swap-space, memory
\begin_inset LatexCommand \index{memory}
\end_inset
management
\begin_inset LatexCommand \index{management}
\end_inset
and various other tasks.
\begin_inset LatexCommand \index{tasks}
\end_inset
\end_deeper
\layout Description
service
\begin_inset LatexCommand \index{service}
\end_inset
\emph on
service
\emph default
is a shell
\begin_inset LatexCommand \index{shell}
\end_inset
script available
\begin_inset LatexCommand \index{available}
\end_inset
on Mandrake/Mandriva and Redhat
\begin_inset LatexCommand \index{Redhat}
\end_inset
systems
\begin_inset LatexCommand \index{systems}
\end_inset
which allows
\begin_inset LatexCommand \index{allows}
\end_inset
you to perform
\begin_inset LatexCommand \index{perform}
\end_inset
various tasks
\begin_inset LatexCommand \index{tasks}
\end_inset
on services.
\begin_inset LatexCommand \index{services}
\end_inset
\begin_deeper
\layout Itemize
Use the
\emph on
-s
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to print
\begin_inset LatexCommand \index{print}
\end_inset
the status
\begin_inset LatexCommand \index{status}
\end_inset
of all services
\begin_inset LatexCommand \index{services}
\end_inset
available
\begin_inset LatexCommand \index{available}
\end_inset
\layout Itemize
Use the
\emph on
-f
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
followed
\begin_inset LatexCommand \index{followed}
\end_inset
by a service
\begin_inset LatexCommand \index{service}
\end_inset
name to restart
\begin_inset LatexCommand \index{restart}
\end_inset
that particular
\begin_inset LatexCommand \index{particular}
\end_inset
service.
\layout Itemize
Use the
\emph on
-R
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to restart
\begin_inset LatexCommand \index{restart}
\end_inset
all services
\begin_inset LatexCommand \index{services}
\end_inset
(note that this will kill
\begin_inset LatexCommand \index{kill}
\end_inset
any current
\begin_inset LatexCommand \index{current}
\end_inset
services running,
\begin_inset LatexCommand \index{running}
\end_inset
including
\begin_inset LatexCommand \index{including}
\end_inset
X).
\layout Standard
For example
\begin_inset LatexCommand \index{example}
\end_inset
to restart
\begin_inset LatexCommand \index{restart}
\end_inset
the daemon
\begin_inset LatexCommand \index{daemon}
\end_inset
\emph on
sshd
\begin_inset LatexCommand \index{sshd}
\end_inset
\emph default
you would type:
\layout Code
service -f sshd
\end_deeper
\layout Description
Using\SpecialChar ~
the\SpecialChar ~
script\SpecialChar ~
directly You may also execute
\begin_inset LatexCommand \index{execute}
\end_inset
the shell
\begin_inset LatexCommand \index{shell}
\end_inset
script directly from
\emph on
/etc/init.d
\emph default
.
Simply go to that directory
\begin_inset LatexCommand \index{directory}
\end_inset
then type
\emph on
./script_name
\emph default
.
\begin_deeper
\layout Standard
Executing the script
\begin_inset LatexCommand \index{script}
\end_inset
should return
\begin_inset LatexCommand \index{return}
\end_inset
the options
\begin_inset LatexCommand \index{options}
\end_inset
it can take,
\begin_inset LatexCommand \index{take}
\end_inset
by default
\begin_inset LatexCommand \index{default}
\end_inset
they will be:
\layout Itemize
restart
\begin_inset LatexCommand \index{restart}
\end_inset
--- this will make the service
\begin_inset LatexCommand \index{service}
\end_inset
stop
\begin_inset LatexCommand \index{stop}
\end_inset
and then start
\begin_inset LatexCommand \index{start}
\end_inset
again.
\layout Itemize
start --- this option
\begin_inset LatexCommand \index{option}
\end_inset
will start
\begin_inset LatexCommand \index{start}
\end_inset
a service
\begin_inset LatexCommand \index{service}
\end_inset
(assuming its not running).
\layout Itemize
stop --- this option
\begin_inset LatexCommand \index{option}
\end_inset
will stop
\begin_inset LatexCommand \index{stop}
\end_inset
a service
\begin_inset LatexCommand \index{service}
\end_inset
(assuming its running).
\layout Itemize
status
\begin_inset LatexCommand \index{status}
\end_inset
--- this option
\begin_inset LatexCommand \index{option}
\end_inset
will tell
\begin_inset LatexCommand \index{tell}
\end_inset
you about the service
\begin_inset LatexCommand \index{service}
\end_inset
\end_deeper
\layout Chapter
Managing users
\begin_inset LatexCommand \label{Managing-users}
\end_inset
\layout Description
su\SpecialChar ~
username
\begin_inset LatexCommand \index{username}
\end_inset
(Switch User), change
\begin_inset LatexCommand \index{change}
\end_inset
to a different
\begin_inset LatexCommand \index{different}
\end_inset
user.
\begin_inset LatexCommand \index{user}
\end_inset
\begin_deeper
\layout Standard
Use
\emph on
su\SpecialChar ~
-
\emph default
to switch
\begin_inset LatexCommand \index{switch}
\end_inset
to root
\begin_inset LatexCommand \index{root}
\end_inset
or
\emph on
su
\begin_inset LatexCommand \index{su}
\end_inset
username
\emph default
, to switch
\begin_inset LatexCommand \index{switch}
\end_inset
to a different
\begin_inset LatexCommand \index{different}
\end_inset
username.
\begin_inset LatexCommand \index{username}
\end_inset
\layout SGML
\layout SGML
Using sudo
\layout SGML
Its often considered better practice to use the
\emph on
sudo
\emph default
command rather than switch to the root user
\layout SGML
The
\emph on
sudo
\emph default
command allows you to perform actions as root but logs the actions you
take (so you can trace anything that was done to the system by yourself
or others).
\emph on
sudo
\emph default
has a very good manual page which provides plenty of information about
it.
\layout SGML
You use sudo similar to how you execute a normal command with sudo
prepended to it, for example:
\layout SGML
sudo rpm -U myrpm.i386.rpm
\layout SGML
This would allow you to install a rpm even if you have the correct
sudo access
\layout SGML
\layout Standard
Note that if you want to return
\begin_inset LatexCommand \index{return}
\end_inset
to your original
\begin_inset LatexCommand \index{original}
\end_inset
user
\begin_inset LatexCommand \index{user}
\end_inset
you don't use
\emph on
su
\emph default
again, type
\emph on
exit
\emph default
or press
\begin_inset LatexCommand \index{press}
\end_inset
CTRL-D.
\layout Standard
Simply typing
\emph on
su
\emph default
will give you some root
\begin_inset LatexCommand \index{root}
\end_inset
privileges,
\begin_inset LatexCommand \index{privileges}
\end_inset
but there are minor
\begin_inset LatexCommand \index{minor}
\end_inset
complications relating to environment
\begin_inset LatexCommand \index{environment}
\end_inset
variables.
It's generally considered better practice
\begin_inset LatexCommand \index{practice}
\end_inset
to use
\emph on
su\SpecialChar ~
-
\emph default
because it has no restrictions.
\begin_inset LatexCommand \index{restrictions}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
do I need to explain why? I think it relates to not having certain environment
variables as root so you are slightly restricted (but I'm not sure)\SpecialChar \ldots{}
LinuxChix
group knows.
\layout Standard
probably similar to the information on newgrp (using the - and not using
it)\SpecialChar \ldots{}
reinitializes the environment.
Added an explanation that I *think* is correct.
\end_inset
\end_deeper
\layout Description
root
\begin_inset LatexCommand \index{root}
\end_inset
The superuser.
\begin_inset LatexCommand \index{superuser}
\end_inset
This user
\begin_inset LatexCommand \index{user}
\end_inset
has power
\begin_inset LatexCommand \index{power}
\end_inset
over everything
\begin_inset LatexCommand \index{everything}
\end_inset
and all, and can do anything with the system
\begin_inset LatexCommand \index{system}
\end_inset
(including destroy
\begin_inset LatexCommand \index{destroy}
\end_inset
it, and of course fix
\begin_inset LatexCommand \index{fix}
\end_inset
it :)).
This user
\begin_inset LatexCommand \index{user}
\end_inset
is used to perform
\begin_inset LatexCommand \index{perform}
\end_inset
most administration
\begin_inset LatexCommand \index{administration}
\end_inset
functions
\begin_inset LatexCommand \index{functions}
\end_inset
on the system.
\begin_inset LatexCommand \index{system}
\end_inset
\layout Section
\noindent
Users/Groups
\begin_inset LatexCommand \label{users-and-groups}
\end_inset
\layout Standard
\begin_inset Note
collapsed true
\layout Subsubsection
General
\begin_inset LatexCommand \label{general}
\end_inset
\layout Description
id Print UID and GID (user and group ID) information of a particular user.
\begin_deeper
\layout Standard
Command syntax:
\layout Code
id user_name
\layout Standard
This will print out the UID and GID for that particular user.
\end_deeper
\layout Description
users Lists which users are currently logged into the system.
Doesn't need or take any options.
\begin_deeper
\layout Standard
Simply type:
\layout Code
users
\end_deeper
\layout Subsubsection
User Specific
\begin_inset LatexCommand \label{user-specific}
\end_inset
\layout Description
useradd Adds a new user to the system.
\layout Standard
Command syntax:
\layout Code
useradd user_name
\layout Description
adduser Same as above.
Sometimes used instead of
\emph on
useradd
\emph default
, on some systems it's simply a symbolic link to
\emph on
useradd
\emph default
.
\layout Description
\noindent
userdel Deletes a user and their related files (home directory, mail directory).
\begin_deeper
\layout Standard
\noindent
Command syntax:
\layout Code
userdel user_name
\end_deeper
\layout Description
deluser Same as above.
Sometimes used instead of
\emph on
userdel
\emph default
, on some systems it's simply a symbolic link to
\emph on
userdel.
\layout Description
\noindent
usermod To change certain attributes of a user (eg.
name).
\begin_deeper
\layout SGML
\layout SGML
Tip:
\layout SGML
\layout SGML
Use the
\emph on
-g
\emph default
switch to specify the initial group of the user.
Then use the
\emph on
-G
\emph default
option to specify supplementary groups, you will need to list all groups
you want the user to be in (because this will replace any existing group
memberships).
\layout SGML
\layout SGML
\end_deeper
\layout Subsubsection
Group Specific
\begin_inset LatexCommand \label{group-specific}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
Tis might be useful but I don't know what it does really\SpecialChar \ldots{}
\layout Standard
gpasswd This command allows the administration of the /etc/group file.
\layout Standard
You can use this command to add administrators to a particular group, these
admins can then add or remove users.
\layout Standard
gpasswd group_name -A list_of_users
\end_inset
\layout Description
\noindent
chgrp To change which group the file belongs too (so more users can access
it).
\begin_deeper
\layout Standard
\noindent
Command syntax:
\layout Code
chgrp group_name file_or_files
\end_deeper
\layout Description
\noindent
groupadd Create a new group (so you can add users to this new group).
\begin_deeper
\layout Standard
\noindent
Command syntax:
\layout Code
groupadd group_name
\end_deeper
\layout Description
\noindent
groupdel Delete a group from the system.
\begin_deeper
\layout Code
groupdel group_name
\end_deeper
\layout Description
\noindent
groupmod Modify group information (eg.
to change the name of a group).
\layout Description
\noindent
groups To find out what groups you are in or what groups other users are
in.
\begin_deeper
\layout Standard
\noindent
Command syntax:
\layout Code
groups user_name
\end_inset
\layout Standard
All user
\begin_inset LatexCommand \index{user}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
is normally listed
\begin_inset LatexCommand \index{listed}
\end_inset
in the
\begin_inset Quotes eld
\end_inset
/etc/passwd
\begin_inset Quotes erd
\end_inset
file
\begin_inset LatexCommand \index{file}
\end_inset
and the group
\begin_inset LatexCommand \index{group}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
in the
\begin_inset Quotes eld
\end_inset
/etc/groups
\begin_inset Quotes erd
\end_inset
file.
\begin_inset LatexCommand \index{file}
\end_inset
\layout Standard
If you need to edit
\begin_inset LatexCommand \index{edit}
\end_inset
either file
\begin_inset LatexCommand \index{file}
\end_inset
it is recommended
\begin_inset LatexCommand \index{recommended}
\end_inset
that you use
\emph on
vipw
\emph default
to edit
\begin_inset LatexCommand \index{edit}
\end_inset
the password
\begin_inset LatexCommand \index{password}
\end_inset
file and
\emph on
vigr
\emph default
to edit
\begin_inset LatexCommand \index{edit}
\end_inset
the group
\begin_inset LatexCommand \index{group}
\end_inset
file.
These particular
\begin_inset LatexCommand \index{particular}
\end_inset
commands
\begin_inset LatexCommand \index{commands}
\end_inset
take
\begin_inset LatexCommand \index{take}
\end_inset
care of any processing
\begin_inset LatexCommand \index{processing}
\end_inset
and locking
\begin_inset LatexCommand \index{locking}
\end_inset
of the files
\begin_inset LatexCommand \index{files}
\end_inset
before and after editing
\begin_inset LatexCommand \index{editing}
\end_inset
them.
\layout Standard
There is a lot of information
\begin_inset LatexCommand \index{information}
\end_inset
about adding/removing/controlling users
\begin_inset LatexCommand \index{users}
\end_inset
and groups,
\begin_inset LatexCommand \index{groups}
\end_inset
this information
\begin_inset LatexCommand \index{information}
\end_inset
is only the minimal
\begin_inset LatexCommand \index{minimal}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
required.
\layout Description
chsh
\begin_inset LatexCommand \index{chsh}
\end_inset
Used to change
\begin_inset LatexCommand \index{change}
\end_inset
your login
\begin_inset LatexCommand \index{login}
\end_inset
shell.
\begin_inset LatexCommand \index{shell}
\end_inset
\begin_deeper
\layout Standard
To list
\begin_inset LatexCommand \index{list}
\end_inset
the shells
\begin_inset LatexCommand \index{shells}
\end_inset
available
\begin_inset LatexCommand \index{available}
\end_inset
type:
\layout Code
chsh --list-shells
\layout Standard
Simply type
\emph on
chsh
\begin_inset LatexCommand \index{chsh}
\end_inset
\emph default
then [Enter], then type the name of the shell
\begin_inset LatexCommand \index{shell}
\end_inset
you would like to use every time
\begin_inset LatexCommand \index{time}
\end_inset
you login.
\begin_inset LatexCommand \index{login}
\end_inset
\end_deeper
\layout Description
chfn
\begin_inset LatexCommand \index{chfn}
\end_inset
Change
\begin_inset LatexCommand \index{Change}
\end_inset
finger
\begin_inset LatexCommand \index{finger}
\end_inset
information.
\begin_inset LatexCommand \index{information}
\end_inset
\begin_deeper
\layout Standard
The information
\begin_inset LatexCommand \index{information}
\end_inset
this command
\begin_inset LatexCommand \index{command}
\end_inset
changes is reflected
\begin_inset LatexCommand \index{reflected}
\end_inset
in the /etc/passwd file,
\begin_inset LatexCommand \index{file}
\end_inset
use this utility
\begin_inset LatexCommand \index{utility}
\end_inset
to update
\begin_inset LatexCommand \index{update}
\end_inset
your real
\begin_inset LatexCommand \index{real}
\end_inset
name, office
\begin_inset LatexCommand \index{office}
\end_inset
and home
\begin_inset LatexCommand \index{home}
\end_inset
phone numbers
\begin_inset LatexCommand \index{numbers}
\end_inset
(if they exist).
\layout Standard
Use the
\emph on
-f
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to change
\begin_inset LatexCommand \index{change}
\end_inset
a user's full
\begin_inset LatexCommand \index{full}
\end_inset
name.
Use this tool
\begin_inset LatexCommand \index{tool}
\end_inset
as either
\emph on
chfn
\emph default
or
\emph on
chfn
\begin_inset LatexCommand \index{chfn}
\end_inset
user_name
\emph default
(usable by root
\begin_inset LatexCommand \index{root}
\end_inset
only).
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
chfn user_name
\end_deeper
\layout Description
\noindent
passwd
\begin_inset LatexCommand \index{passwd}
\end_inset
Changes the password
\begin_inset LatexCommand \index{password}
\end_inset
of a user.
\begin_inset LatexCommand \index{user}
\end_inset
You will need to be root
\begin_inset LatexCommand \index{root}
\end_inset
if you want to change
\begin_inset LatexCommand \index{change}
\end_inset
other user's passwords.
\begin_inset LatexCommand \index{passwords}
\end_inset
\begin_deeper
\layout Standard
\noindent
Simply type
\emph on
passwd
\begin_inset LatexCommand \index{passwd}
\end_inset
\emph default
to change
\begin_inset LatexCommand \index{change}
\end_inset
your own password
\begin_inset LatexCommand \index{password}
\end_inset
or to change
\begin_inset LatexCommand \index{change}
\end_inset
another user's password
\begin_inset LatexCommand \index{password}
\end_inset
type:
\layout Code
passwd username
\end_deeper
\layout Chapter
Text Related Tools
\begin_inset LatexCommand \label{Text-related-tools}
\end_inset
\layout Standard
The text
\begin_inset LatexCommand \index{text}
\end_inset
related tools
\begin_inset LatexCommand \index{tools}
\end_inset
chapter is the largest in this guide,
\begin_inset LatexCommand \index{guide}
\end_inset
most of the time
\begin_inset LatexCommand \index{time}
\end_inset
on a GNU/Linux machine
\begin_inset LatexCommand \index{machine}
\end_inset
you will spend
\begin_inset LatexCommand \index{spend}
\end_inset
time
\begin_inset LatexCommand \index{time}
\end_inset
interacting with text.
\begin_inset LatexCommand \index{text}
\end_inset
This chapter briefly covers text
\begin_inset LatexCommand \index{text}
\end_inset
editors
\begin_inset LatexCommand \index{editors}
\end_inset
and goes into more
\begin_inset LatexCommand \index{more}
\end_inset
depth
\begin_inset LatexCommand \index{depth}
\end_inset
on viewing
\begin_inset LatexCommand \index{viewing}
\end_inset
text,
\begin_inset LatexCommand \index{text}
\end_inset
using tools
\begin_inset LatexCommand \index{tools}
\end_inset
to manipulate
\begin_inset LatexCommand \index{manipulate}
\end_inset
text,
\begin_inset LatexCommand \index{text}
\end_inset
finding
\begin_inset LatexCommand \index{finding}
\end_inset
text within files
\begin_inset LatexCommand \index{files}
\end_inset
and changing text
\begin_inset LatexCommand \index{text}
\end_inset
formats
\begin_inset LatexCommand \index{formats}
\end_inset
between windows
\begin_inset LatexCommand \index{windows}
\end_inset
based systems
\begin_inset LatexCommand \index{systems}
\end_inset
and GNU/Linux based systems.
\layout Section
Text Editors
\begin_inset LatexCommand \label{text-editors}
\end_inset
\layout Description
vi
\begin_inset LatexCommand \index{vi}
\end_inset
A traditional
\begin_inset LatexCommand \index{traditional}
\end_inset
UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
text editor,
\begin_inset LatexCommand \index{editor}
\end_inset
should be on any UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system.
It is fairly difficult to learn
\begin_inset LatexCommand \index{learn}
\end_inset
but quite
\begin_inset LatexCommand \index{quite}
\end_inset
powerful, it is also quite
\begin_inset LatexCommand \index{quite}
\end_inset
small and uses minimal
\begin_inset LatexCommand \index{minimal}
\end_inset
amounts of resources.
\begin_inset LatexCommand \index{resources}
\end_inset
\begin_deeper
\layout SGML
\layout SGML
vim
\layout SGML
\emph on
vim
\emph default
- vi improved.
A newer version of the vulnerable
\emph on
vi
\emph default
editor.
Many systems use
\emph on
vim
\emph default
rather than
\emph on
vi
\emph default
.
\layout SGML
\layout SGML
\end_deeper
\layout Description
emacs
\begin_inset LatexCommand \index{emacs}
\end_inset
More than just a text
\begin_inset LatexCommand \index{text}
\end_inset
editor.
\begin_inset LatexCommand \index{editor}
\end_inset
This text
\begin_inset LatexCommand \index{text}
\end_inset
editor
\begin_inset LatexCommand \index{editor}
\end_inset
has a steep
\begin_inset LatexCommand \index{steep}
\end_inset
learning
\begin_inset LatexCommand \index{learning}
\end_inset
curve but is also very powerful,
\begin_inset LatexCommand \index{powerful}
\end_inset
it is both advanced
\begin_inset LatexCommand \index{advanced}
\end_inset
and quite
\begin_inset LatexCommand \index{quite}
\end_inset
large.
Emacs
\begin_inset LatexCommand \index{Emacs}
\end_inset
can do anything, surf
\begin_inset LatexCommand \index{surf}
\end_inset
the internet,
\begin_inset LatexCommand \index{internet}
\end_inset
chat,
\begin_inset LatexCommand \index{chat}
\end_inset
play
\begin_inset LatexCommand \index{play}
\end_inset
games and many other tasks.
\begin_inset LatexCommand \index{tasks}
\end_inset
\layout Description
Others There are too many different
\begin_inset LatexCommand \index{different}
\end_inset
text
\begin_inset LatexCommand \index{text}
\end_inset
editors
\begin_inset LatexCommand \index{editors}
\end_inset
to list
\begin_inset LatexCommand \index{list}
\end_inset
here.
Have a look
\begin_inset LatexCommand \index{look}
\end_inset
on the internet,
\begin_inset LatexCommand \index{internet}
\end_inset
either search
\begin_inset LatexCommand \index{search}
\end_inset
for them you will find
\begin_inset LatexCommand \index{find}
\end_inset
many of them at
\begin_inset LatexCommand \url[Sourceforge]{https://sourceforge.net/}
\end_inset
or
\begin_inset LatexCommand \url[Freshmeat.]{https://freshmeat.net/}
\end_inset
\layout Section
Text Viewing Tools
\begin_inset LatexCommand \label{text-viewing-tools}
\end_inset
\layout Description
head
\begin_inset LatexCommand \index{head}
\end_inset
With no options
\begin_inset LatexCommand \index{options}
\end_inset
it shows
\begin_inset LatexCommand \index{shows}
\end_inset
the first ten
\begin_inset LatexCommand \index{ten}
\end_inset
lines
\begin_inset LatexCommand \index{lines}
\end_inset
of a text
\begin_inset LatexCommand \index{text}
\end_inset
file.
\begin_deeper
\layout Standard
\noindent
Use
\emph on
head
\begin_inset LatexCommand \index{head}
\end_inset
-n
\begin_inset LatexCommand \index{-n}
\end_inset
x
\emph default
(where
\begin_inset Quotes eld
\end_inset
x
\begin_inset Quotes erd
\end_inset
is a number) to display
\begin_inset LatexCommand \index{display}
\end_inset
the first x
\emph on
\emph default
lines.
\layout Standard
\noindent
Try
\begin_inset LatexCommand \index{Try}
\end_inset
\emph on
head
\begin_inset LatexCommand \index{head}
\end_inset
-F
\begin_inset LatexCommand \index{-F}
\end_inset
\emph default
to use a continually updated
\begin_inset LatexCommand \index{updated}
\end_inset
version
\begin_inset LatexCommand \index{version}
\end_inset
of
\emph on
head
\emph default
(if the file
\begin_inset LatexCommand \index{file}
\end_inset
changes it will be reloaded
\begin_inset LatexCommand \index{reloaded}
\end_inset
and displayed), please note that using this option
\begin_inset LatexCommand \index{option}
\end_inset
will run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
head
\emph default
is a continuous
\begin_inset LatexCommand \index{continuous}
\end_inset
loop so you'll need to use CTRL-C to exit.
\begin_inset LatexCommand \index{exit}
\end_inset
\layout Standard
\noindent
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
head -n 20 somelog.txt
\layout Standard
Will display
\begin_inset LatexCommand \index{display}
\end_inset
the top
\begin_inset LatexCommand \index{top}
\end_inset
20 entries
\begin_inset LatexCommand \index{entries}
\end_inset
of the file
\begin_inset LatexCommand \index{file}
\end_inset
\begin_inset Quotes eld
\end_inset
somelog.txt
\begin_inset Quotes erd
\end_inset
.
\end_deeper
\layout Description
\noindent
tail
\begin_inset LatexCommand \index{tail}
\end_inset
With no options
\begin_inset LatexCommand \index{options}
\end_inset
it shows
\begin_inset LatexCommand \index{shows}
\end_inset
the last
\begin_inset LatexCommand \index{last}
\end_inset
ten lines
\begin_inset LatexCommand \index{lines}
\end_inset
of a file.
\begin_inset LatexCommand \index{file}
\end_inset
\begin_deeper
\layout Standard
\noindent
Use
\emph on
tail
\begin_inset LatexCommand \index{tail}
\end_inset
-n
\begin_inset LatexCommand \index{-n}
\end_inset
x
\emph default
(where
\begin_inset Quotes eld
\end_inset
x
\begin_inset Quotes erd
\end_inset
is a number) to display
\begin_inset LatexCommand \index{display}
\end_inset
the last
\begin_inset LatexCommand \index{last}
\end_inset
\emph on
x
\emph default
lines.
\layout Standard
\noindent
Try
\begin_inset LatexCommand \index{Try}
\end_inset
\emph on
tail
\begin_inset LatexCommand \index{tail}
\end_inset
-F
\begin_inset LatexCommand \index{-F}
\end_inset
\emph default
to use a continually updated
\begin_inset LatexCommand \index{updated}
\end_inset
version
\begin_inset LatexCommand \index{version}
\end_inset
of
\emph on
tail
\emph default
(if the file
\begin_inset LatexCommand \index{file}
\end_inset
changes it will be reloaded
\begin_inset LatexCommand \index{reloaded}
\end_inset
and displayed), please note that using this option
\begin_inset LatexCommand \index{option}
\end_inset
will run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
tail
\emph default
is a continuous
\begin_inset LatexCommand \index{continuous}
\end_inset
loop so you'll need to use CTRL-C to exit.
\begin_inset LatexCommand \index{exit}
\end_inset
\layout Standard
\noindent
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
tail -n 20 somelog.txt
\layout Standard
Will display
\begin_inset LatexCommand \index{display}
\end_inset
the last
\begin_inset LatexCommand \index{last}
\end_inset
20 entries
\begin_inset LatexCommand \index{entries}
\end_inset
of the file
\begin_inset LatexCommand \index{file}
\end_inset
\begin_inset Quotes eld
\end_inset
somelog.txt
\begin_inset Quotes erd
\end_inset
.
\end_deeper
\layout Description
\noindent
less
\begin_inset LatexCommand \index{less}
\end_inset
Views text,
\begin_inset LatexCommand \index{text}
\end_inset
can scroll
\begin_inset LatexCommand \index{scroll}
\end_inset
backwards and forwards.
\begin_inset LatexCommand \index{forwards}
\end_inset
Has many different
\begin_inset LatexCommand \index{different}
\end_inset
options
\begin_inset LatexCommand \index{options}
\end_inset
which are all described
\begin_inset LatexCommand \index{described}
\end_inset
in the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page.
\begin_inset LatexCommand \index{page}
\end_inset
\begin_deeper
\layout Standard
\noindent
When less
\begin_inset LatexCommand \index{less}
\end_inset
is already running,
\begin_inset LatexCommand \index{running}
\end_inset
use :n and :p (type a colon
\begin_inset LatexCommand \index{colon}
\end_inset
then the character) to move
\begin_inset LatexCommand \index{move}
\end_inset
to the next
\begin_inset LatexCommand \index{next}
\end_inset
and previous
\begin_inset LatexCommand \index{previous}
\end_inset
files (when there are multiple
\begin_inset LatexCommand \index{multiple}
\end_inset
open
\begin_inset LatexCommand \index{open}
\end_inset
files).
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
less filename.txt
\layout Standard
Or using a tool
\begin_inset LatexCommand \index{tool}
\end_inset
(in this example
\begin_inset LatexCommand \index{example}
\end_inset
\emph on
cat
\emph default
):
\layout Code
cat file.txt | less
\end_deeper
\layout Description
\noindent
more Displays text,
\begin_inset LatexCommand \index{text}
\end_inset
one page
\begin_inset LatexCommand \index{page}
\end_inset
full at a time,
\begin_inset LatexCommand \index{time}
\end_inset
more
\begin_inset LatexCommand \index{more}
\end_inset
limited than
\emph on
less
\emph default
.
In this case
\emph on
less
\emph default
is better than
\emph on
more
\emph default
.
\begin_deeper
\layout Code
more filename.txt
\layout Standard
Or using a tool
\begin_inset LatexCommand \index{tool}
\end_inset
(is this example
\begin_inset LatexCommand \index{example}
\end_inset
cat):
\layout Code
cat file.txt | more
\end_deeper
\layout Description
\noindent
cat
\begin_inset LatexCommand \label{cat}
\end_inset
Combines
\begin_inset LatexCommand \index{Combines}
\end_inset
(concatenates) multiple
\begin_inset LatexCommand \index{multiple}
\end_inset
documents
\begin_inset LatexCommand \index{documents}
\end_inset
into one document.
\begin_inset LatexCommand \index{document}
\end_inset
Can be used on individual
\begin_inset LatexCommand \index{individual}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
as well.
\begin_deeper
\layout Standard
\noindent
Some useful options:
\begin_inset LatexCommand \index{options}
\end_inset
\layout Itemize
\noindent
\emph on
-b
\emph default
--- number
\begin_inset LatexCommand \index{number}
\end_inset
all non-blank
\begin_inset LatexCommand \index{non-blank}
\end_inset
lines
\begin_inset LatexCommand \index{lines}
\end_inset
\layout Itemize
\noindent
\emph on
-n
\emph default
--- number
\begin_inset LatexCommand \index{number}
\end_inset
all lines.
\begin_inset LatexCommand \index{lines}
\end_inset
\layout Standard
\noindent
Also try
\begin_inset LatexCommand \index{try}
\end_inset
using
\emph on
nl
\emph default
to number
\begin_inset LatexCommand \index{number}
\end_inset
lines
\begin_inset LatexCommand \index{lines}
\end_inset
(it can do more
\begin_inset LatexCommand \index{more}
\end_inset
complex
\begin_inset LatexCommand \index{complex}
\end_inset
numbering), find
\begin_inset LatexCommand \index{find}
\end_inset
it under under this section,
\begin_inset LatexCommand \index{section}
\end_inset
\begin_inset LatexCommand \ref{text-manipulation-tools}
\end_inset
\layout Standard
\noindent
Example:
\layout Code
cat filepart1 filepart2 filepart3 > wholefile.txt
\layout Standard
Would combine
\begin_inset LatexCommand \index{combine}
\end_inset
(concatenate) filepart1,
\begin_inset LatexCommand \index{filepart1}
\end_inset
filepart2
\begin_inset LatexCommand \index{filepart2}
\end_inset
and filepart3
\begin_inset LatexCommand \index{filepart3}
\end_inset
into the single file
\begin_inset LatexCommand \index{file}
\end_inset
\begin_inset Quotes eld
\end_inset
wholefile.txt
\begin_inset Quotes erd
\end_inset
.
\end_deeper
\layout Description
\noindent
tac
\begin_inset LatexCommand \index{tac}
\end_inset
Combines (concatenates) multiple
\begin_inset LatexCommand \index{multiple}
\end_inset
documents
\begin_inset LatexCommand \index{documents}
\end_inset
into one document
\begin_inset LatexCommand \index{document}
\end_inset
and outputs
\begin_inset LatexCommand \index{outputs}
\end_inset
them in reverse.
\begin_inset LatexCommand \index{reverse}
\end_inset
Can also be used on individual
\begin_inset LatexCommand \index{individual}
\end_inset
files.
\begin_inset LatexCommand \index{files}
\end_inset
Notice that
\emph on
tac
\emph default
is
\emph on
cat
\emph default
written
\begin_inset LatexCommand \index{written}
\end_inset
backwards.
\begin_deeper
\layout Standard
\noindent
Example:
\layout Code
tac filepart1 filepart2 filepart3 > wholefile.txt
\layout Standard
Would combine
\begin_inset LatexCommand \index{combine}
\end_inset
(concatenate) filepart1,
\begin_inset LatexCommand \index{filepart1}
\end_inset
filepart2
\begin_inset LatexCommand \index{filepart2}
\end_inset
and filepart3
\begin_inset LatexCommand \index{filepart3}
\end_inset
into the single file
\begin_inset LatexCommand \index{file}
\end_inset
but have each of the files
\begin_inset LatexCommand \index{files}
\end_inset
written
\begin_inset LatexCommand \index{written}
\end_inset
in reverse.
\begin_inset LatexCommand \index{reverse}
\end_inset
\end_deeper
\layout Description
z*\SpecialChar ~
commands Many commands
\begin_inset LatexCommand \index{commands}
\end_inset
can be prefixed
\begin_inset LatexCommand \index{prefixed}
\end_inset
with a
\begin_inset Quotes eld
\end_inset
z
\begin_inset Quotes erd
\end_inset
to read/work within a gzip
\begin_inset LatexCommand \index{gzip}
\end_inset
compressed file.
\begin_inset LatexCommand \index{file}
\end_inset
\begin_deeper
\layout Standard
Some examples
\begin_inset LatexCommand \index{examples}
\end_inset
are
\emph on
zcat, zless,
\begin_inset LatexCommand \index{zless}
\end_inset
zmore,
\begin_inset LatexCommand \index{zmore}
\end_inset
zgrep,
\begin_inset LatexCommand \index{zgrep}
\end_inset
zcmp,
\begin_inset LatexCommand \index{zcmp}
\end_inset
zdiff
\begin_inset LatexCommand \index{zdiff}
\end_inset
\emph default
.
\layout Standard
There are many utilities
\begin_inset LatexCommand \index{utilities}
\end_inset
for working
\begin_inset LatexCommand \index{working}
\end_inset
with text
\begin_inset LatexCommand \index{text}
\end_inset
within compressed
\begin_inset LatexCommand \index{compressed}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
without trying to manually de-compress them somewhere first\SpecialChar \ldots{}
most begin with
a
\begin_inset Quotes eld
\end_inset
z
\begin_inset Quotes erd
\end_inset
.
\end_deeper
\layout Description
bz*\SpecialChar ~
commands There are also a few commands
\begin_inset LatexCommand \index{commands}
\end_inset
that prefixed
\begin_inset LatexCommand \index{prefixed}
\end_inset
with a
\begin_inset Quotes eld
\end_inset
bz
\begin_inset Quotes erd
\end_inset
to read/work within a file
\begin_inset LatexCommand \index{file}
\end_inset
compressed
\begin_inset LatexCommand \index{compressed}
\end_inset
with bzip2.
\begin_inset LatexCommand \index{bzip2}
\end_inset
\begin_deeper
\layout Standard
The tools
\begin_inset LatexCommand \index{tools}
\end_inset
are
\emph on
bzcat, bzless,
\begin_inset LatexCommand \index{bzless}
\end_inset
bzgrep
\begin_inset LatexCommand \index{bzgrep}
\end_inset
\end_deeper
\layout Section
Text Information Tools
\begin_inset LatexCommand \label{text-information-tools}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
aim is to provide some kind of information on text, not view or format them
as such\SpecialChar \ldots{}
\end_inset
\layout Description
wc
\begin_inset LatexCommand \index{wc}
\end_inset
Word
\begin_inset LatexCommand \index{Word}
\end_inset
count, count
\begin_inset LatexCommand \index{count}
\end_inset
how many words
\begin_inset LatexCommand \index{words}
\end_inset
you have in a text
\begin_inset LatexCommand \index{text}
\end_inset
document.
Can also be used to count
\begin_inset LatexCommand \index{count}
\end_inset
the lines
\begin_inset LatexCommand \index{lines}
\end_inset
or bytes
\begin_inset LatexCommand \index{bytes}
\end_inset
within the file.
\begin_inset LatexCommand \index{file}
\end_inset
\begin_deeper
\layout Standard
\noindent
Use the options
\begin_inset LatexCommand \index{options}
\end_inset
\emph on
-w
\begin_inset LatexCommand \index{-w}
\end_inset
\emph default
for words,
\begin_inset LatexCommand \index{words}
\end_inset
\emph on
-l
\emph default
for lines
\begin_inset LatexCommand \index{lines}
\end_inset
and
\emph on
-c
\emph default
for bytes.
\begin_inset LatexCommand \index{bytes}
\end_inset
Or simply run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
wc
\emph default
with no options
\begin_inset LatexCommand \index{options}
\end_inset
to get all three.
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
wc -option file.txt
\end_deeper
\layout Description
style
\begin_inset LatexCommand \index{style}
\end_inset
To run
\begin_inset LatexCommand \index{run}
\end_inset
various readability
\begin_inset LatexCommand \index{readability}
\end_inset
tests on a particular
\begin_inset LatexCommand \index{particular}
\end_inset
text
\begin_inset LatexCommand \index{text}
\end_inset
file.
Will output
\begin_inset LatexCommand \index{output}
\end_inset
scores
\begin_inset LatexCommand \index{scores}
\end_inset
on a number
\begin_inset LatexCommand \index{number}
\end_inset
of different
\begin_inset LatexCommand \index{different}
\end_inset
readability
\begin_inset LatexCommand \index{readability}
\end_inset
tests (with no options).
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
style -options text_file
\layout SGML
\layout SGML
Find style in the diction package
\layout SGML
This command is part of the diction package and does not appear to
be used too often these days
\layout SGML
\end_deeper
\layout Description
cmp
\begin_inset LatexCommand \index{cmp}
\end_inset
Determines whether or not two files
\begin_inset LatexCommand \index{files}
\end_inset
differ, works
\begin_inset LatexCommand \index{works}
\end_inset
on any type of file.
\begin_inset LatexCommand \index{file}
\end_inset
Very similar
\begin_inset LatexCommand \index{similar}
\end_inset
to
\emph on
diff
\emph default
only it compares
\begin_inset LatexCommand \index{compares}
\end_inset
on the binary
\begin_inset LatexCommand \index{binary}
\end_inset
level instead of just the text.
\begin_inset LatexCommand \index{text}
\end_inset
\layout Description
\noindent
diff
\begin_inset LatexCommand \index{diff}
\end_inset
Compares two text
\begin_inset LatexCommand \index{text}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
and output
\begin_inset LatexCommand \index{output}
\end_inset
a difference
\begin_inset LatexCommand \index{difference}
\end_inset
report (sometimes called a "diff"
\begin_inset LatexCommand \index{diff}
\end_inset
) containing the text
\begin_inset LatexCommand \index{text}
\end_inset
that differs between two files.
\begin_inset LatexCommand \index{files}
\end_inset
\begin_deeper
\layout Standard
\noindent
Can be used to create a 'patch' file
\begin_inset LatexCommand \index{file}
\end_inset
(which can be used by
\emph on
patch
\emph default
).
\layout Standard
\noindent
Example:
\layout Code
diff file1.txt file2.txt
\layout Standard
\emph on
diff
\emph default
will output
\begin_inset LatexCommand \index{output}
\end_inset
a '>' (followed by the line) for each line
\begin_inset LatexCommand \index{line}
\end_inset
that isn't in the first file
\begin_inset LatexCommand \index{file}
\end_inset
but is in the second file, and it will output
\begin_inset LatexCommand \index{output}
\end_inset
a '<' (followed by the line) for each line
\begin_inset LatexCommand \index{line}
\end_inset
that is in the first file
\begin_inset LatexCommand \index{file}
\end_inset
but not in the second file.
\begin_inset LatexCommand \index{file}
\end_inset
\end_deeper
\layout Description
\noindent
sdiff
\begin_inset LatexCommand \index{sdiff}
\end_inset
Instead of giving a difference
\begin_inset LatexCommand \index{difference}
\end_inset
report, it outputs
\begin_inset LatexCommand \index{outputs}
\end_inset
the files
\begin_inset LatexCommand \index{files}
\end_inset
in two columns,
\begin_inset LatexCommand \index{columns}
\end_inset
side
\begin_inset LatexCommand \index{side}
\end_inset
by side, separated
\begin_inset LatexCommand \index{separated}
\end_inset
by spaces.
\begin_inset LatexCommand \index{spaces}
\end_inset
\begin_inset Note
collapsed false
\layout Standard
need more info on this
\end_inset
\layout Description
diff3
\begin_inset LatexCommand \index{diff3}
\end_inset
Same as
\emph on
diff
\emph default
except for three files.
\begin_inset LatexCommand \index{files}
\end_inset
\layout Description
\begin_inset Note
collapsed false
\layout Standard
\SpecialChar \ldots{}
also need more info
\end_inset
\layout Description
comm
\begin_inset LatexCommand \index{comm}
\end_inset
Compares two files,
\begin_inset LatexCommand \index{files}
\end_inset
line-by-line
\begin_inset LatexCommand \index{line-by-line}
\end_inset
and prints
\begin_inset LatexCommand \index{prints}
\end_inset
lines
\begin_inset LatexCommand \index{lines}
\end_inset
that are unique
\begin_inset LatexCommand \index{unique}
\end_inset
to file1
\begin_inset LatexCommand \index{file1}
\end_inset
(1st column), unique
\begin_inset LatexCommand \index{unique}
\end_inset
to file
\begin_inset LatexCommand \index{file}
\end_inset
2 (2nd column) and common
\begin_inset LatexCommand \index{common}
\end_inset
to both files
\begin_inset LatexCommand \index{files}
\end_inset
(3rd column).
\begin_deeper
\layout Standard
Use
\emph on
comm
\emph default
with the -1, -2, or -3 to suppress
\begin_inset LatexCommand \index{suppress}
\end_inset
the printing
\begin_inset LatexCommand \index{printing}
\end_inset
of those particular
\begin_inset LatexCommand \index{particular}
\end_inset
lines.
\begin_inset LatexCommand \index{lines}
\end_inset
Simply run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
comm
\emph default
to have all three listed
\begin_inset LatexCommand \index{listed}
\end_inset
(ie.
unique
\begin_inset LatexCommand \index{unique}
\end_inset
to files
\begin_inset LatexCommand \index{files}
\end_inset
1 and 2 and common
\begin_inset LatexCommand \index{common}
\end_inset
to both).
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
comm file1 file2
\end_deeper
\layout Description
look
\begin_inset LatexCommand \index{look}
\end_inset
To output
\begin_inset LatexCommand \index{output}
\end_inset
a list
\begin_inset LatexCommand \index{list}
\end_inset
of words
\begin_inset LatexCommand \index{words}
\end_inset
in the system
\begin_inset LatexCommand \index{system}
\end_inset
dictionary that begin with a given string
\begin_inset LatexCommand \index{string}
\end_inset
-- this is useful for finding
\begin_inset LatexCommand \index{finding}
\end_inset
words
\begin_inset LatexCommand \index{words}
\end_inset
that begin with a particular
\begin_inset LatexCommand \index{particular}
\end_inset
phrase
\begin_inset LatexCommand \index{phrase}
\end_inset
or prefix.
\begin_inset LatexCommand \index{prefix}
\end_inset
\begin_deeper
\layout Standard
Give the string
\begin_inset LatexCommand \index{string}
\end_inset
as an argument;
\begin_inset LatexCommand \index{argument}
\end_inset
it is not case sensitive.
\begin_inset LatexCommand \index{sensitive}
\end_inset
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
look string
\end_deeper
\layout Section
Text manipulation tools
\begin_inset LatexCommand \label{text-manipulation-tools}
\end_inset
\layout SGML
\layout SGML
Also see
\layout SGML
Also see
\emph on
tac
\emph default
, and
\emph on
cat
\emph default
over in this section,
\begin_inset LatexCommand \ref{text-viewing-tools}
\end_inset
, as they can perform text modification too
\layout SGML
\layout Description
\noindent
sort Sorting
\begin_inset LatexCommand \index{Sorting}
\end_inset
text with no options
\begin_inset LatexCommand \index{options}
\end_inset
the sort
\begin_inset LatexCommand \index{sort}
\end_inset
is alphabetical.
\begin_inset LatexCommand \index{alphabetical}
\end_inset
Can be run
\begin_inset LatexCommand \index{run}
\end_inset
on text
\begin_inset LatexCommand \index{text}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
to sort
\begin_inset LatexCommand \index{sort}
\end_inset
them alphabetically
\begin_inset LatexCommand \index{alphabetically}
\end_inset
(note it also concatenates
\begin_inset LatexCommand \index{concatenates}
\end_inset
files), can also be used with a pipe
\begin_inset LatexCommand \index{pipe}
\end_inset
'|' to sort
\begin_inset LatexCommand \index{sort}
\end_inset
the output
\begin_inset LatexCommand \index{output}
\end_inset
of a command.
\begin_inset LatexCommand \index{command}
\end_inset
\begin_deeper
\layout Standard
\noindent
Use
\emph on
sort
\begin_inset LatexCommand \index{sort}
\end_inset
-r
\begin_inset LatexCommand \index{-r}
\end_inset
\emph default
to reverse
\begin_inset LatexCommand \index{reverse}
\end_inset
the sort
\begin_inset LatexCommand \index{sort}
\end_inset
output,
\begin_inset LatexCommand \index{output}
\end_inset
use the
\emph on
-g
\begin_inset LatexCommand \index{-g}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to sort
\begin_inset LatexCommand \index{sort}
\end_inset
'numerically' (ie read
\begin_inset LatexCommand \index{read}
\end_inset
the entire
\begin_inset LatexCommand \index{entire}
\end_inset
number,
\begin_inset LatexCommand \index{number}
\end_inset
not just the first digit).
\begin_inset Note
collapsed true
\layout Standard
tsort doesn't make sense, it's some kind of logical sorting\SpecialChar \ldots{}
topological
sorting.......IBM developer-works describes it but it doesn't make sense.
\end_inset
\layout Standard
\noindent
Examples:
\layout Code
cat shoppinglist.txt | sort
\layout Standard
The above command
\begin_inset LatexCommand \index{command}
\end_inset
would run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
cat
\emph default
on the shopping
\begin_inset LatexCommand \index{shopping}
\end_inset
list
\begin_inset LatexCommand \index{list}
\end_inset
then sort
\begin_inset LatexCommand \index{sort}
\end_inset
the results
\begin_inset LatexCommand \index{results}
\end_inset
and display
\begin_inset LatexCommand \index{display}
\end_inset
them in alphabetical
\begin_inset LatexCommand \index{alphabetical}
\end_inset
order.
\begin_inset LatexCommand \index{order}
\end_inset
\layout Code
sort -r shoppinglist.txt
\layout Standard
The above command
\begin_inset LatexCommand \index{command}
\end_inset
would run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
sort
\emph default
on a file
\begin_inset LatexCommand \index{file}
\end_inset
and
\emph on
sort
\emph default
the file
\begin_inset LatexCommand \index{file}
\end_inset
in reverse
\begin_inset LatexCommand \index{reverse}
\end_inset
alphabetical
\begin_inset LatexCommand \index{alphabetical}
\end_inset
order.
\layout Standard
\added_space_top medskip \noindent
\begin_inset LatexCommand \index{medskip}
\end_inset
\series bold
Advanced sort
\begin_inset LatexCommand \index{sort}
\end_inset
commands:
\begin_inset LatexCommand \index{commands}
\end_inset
\layout Standard
\noindent
\emph on
sort
\emph default
is a powerful
\begin_inset LatexCommand \index{powerful}
\end_inset
utility,
\begin_inset LatexCommand \index{utility}
\end_inset
here are some of the more
\begin_inset LatexCommand \index{more}
\end_inset
hard to learn
\begin_inset LatexCommand \index{learn}
\end_inset
(and lesser
\begin_inset LatexCommand \index{lesser}
\end_inset
used) commands.
\begin_inset LatexCommand \index{commands}
\end_inset
Use the
\emph on
-t
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to use a particular
\begin_inset LatexCommand \index{particular}
\end_inset
symbol
\begin_inset LatexCommand \index{symbol}
\end_inset
as the separator
\begin_inset LatexCommand \index{separator}
\end_inset
then use the
\emph on
-k
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to specify
\begin_inset LatexCommand \index{specify}
\end_inset
which column
\begin_inset LatexCommand \index{column}
\end_inset
you would like to sort
\begin_inset LatexCommand \index{sort}
\end_inset
by, where column 1 is the first column
\begin_inset LatexCommand \index{column}
\end_inset
\emph on
before
\emph default
the separator.
\begin_inset LatexCommand \index{separator}
\end_inset
Also use the
\emph on
-g
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
if numeric
\begin_inset LatexCommand \index{numeric}
\end_inset
sorting is not working
\begin_inset LatexCommand \index{working}
\end_inset
correctly (without the -g
\begin_inset LatexCommand \index{-g}
\end_inset
option sort
\begin_inset LatexCommand \index{sort}
\end_inset
just looks
\begin_inset LatexCommand \index{looks}
\end_inset
at the first digit
\begin_inset LatexCommand \index{digit}
\end_inset
of the number).
Here is a complex
\begin_inset LatexCommand \index{complex}
\end_inset
example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
sort -t : -k 4 -k 1 -g /etc/passwd | more
\layout Standard
This will sort
\begin_inset LatexCommand \index{sort}
\end_inset
the
\begin_inset Quotes eld
\end_inset
/etc/passwd
\begin_inset Quotes erd
\end_inset
file,
\begin_inset LatexCommand \index{file}
\end_inset
using the colon
\begin_inset LatexCommand \index{colon}
\end_inset
':' as the separator.
\begin_inset LatexCommand \index{separator}
\end_inset
It will sort
\begin_inset LatexCommand \index{sort}
\end_inset
via the 4th column
\begin_inset LatexCommand \index{column}
\end_inset
(GID section,
\begin_inset LatexCommand \index{section}
\end_inset
in the file) and then sort within that sort
\begin_inset LatexCommand \index{sort}
\end_inset
using the first (name) if there are any ties.
\begin_inset LatexCommand \index{ties}
\end_inset
The
\emph on
-g
\emph default
is there so it sorts via full
\begin_inset LatexCommand \index{full}
\end_inset
numbers, otherwise it will have 4000 before 50 (it will just look at the
first digit\SpecialChar \ldots{}
).
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
from info page but changed\SpecialChar \ldots{}
AUTHOR Written by Mike Haertel and Paul Eggert.
\layout Standard
not referenced.
it's just too small (1-2 lines!), document doesn't need to be littered
with references.
\end_inset
\end_deeper
\layout Description
join
\begin_inset LatexCommand \index{join}
\end_inset
Will put two lines
\begin_inset LatexCommand \index{lines}
\end_inset
together assuming they share
\begin_inset LatexCommand \index{share}
\end_inset
at least
\begin_inset LatexCommand \index{least}
\end_inset
one common
\begin_inset LatexCommand \index{common}
\end_inset
value
\begin_inset LatexCommand \index{value}
\end_inset
on the relevant
\begin_inset LatexCommand \index{relevant}
\end_inset
line.
It won't print
\begin_inset LatexCommand \index{print}
\end_inset
lines if they don't have a common
\begin_inset LatexCommand \index{common}
\end_inset
value.
\begin_inset LatexCommand \index{value}
\end_inset
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
join file1 file2
\end_deeper
\layout Description
cut
\begin_inset LatexCommand \index{cut}
\end_inset
Prints
\begin_inset LatexCommand \index{Prints}
\end_inset
selected
\begin_inset LatexCommand \index{selected}
\end_inset
parts of lines
\begin_inset LatexCommand \index{lines}
\end_inset
(of a text
\begin_inset LatexCommand \index{text}
\end_inset
file), or, in other words,
\begin_inset LatexCommand \index{words}
\end_inset
removes
\begin_inset LatexCommand \index{removes}
\end_inset
certain sections
\begin_inset LatexCommand \index{sections}
\end_inset
of lines.
\begin_inset LatexCommand \index{lines}
\end_inset
You may wish to remove
\begin_inset LatexCommand \index{remove}
\end_inset
things according to tabs
\begin_inset LatexCommand \index{tabs}
\end_inset
or commas,
\begin_inset LatexCommand \index{commas}
\end_inset
or anything else you can think of\SpecialChar \ldots{}
\begin_deeper
\layout Standard
Options
\begin_inset LatexCommand \index{Options}
\end_inset
for
\emph on
cut:
\layout Itemize
-d
\begin_inset LatexCommand \index{-d}
\end_inset
--- allows
\begin_inset LatexCommand \index{allows}
\end_inset
you to specify
\begin_inset LatexCommand \index{specify}
\end_inset
another delimiter,
\begin_inset LatexCommand \index{delimiter}
\end_inset
for example
\begin_inset LatexCommand \index{example}
\end_inset
':' is often used with /etc/passwd:
\begin_deeper
\layout Code
cut -d ':' (and probably some more options here) /etc/passwd
\end_deeper
\layout Itemize
\emph on
-f
\begin_inset LatexCommand \index{-f}
\end_inset
\emph default
--- this option
\begin_inset LatexCommand \index{option}
\end_inset
works
\begin_inset LatexCommand \index{works}
\end_inset
with the text
\begin_inset LatexCommand \index{text}
\end_inset
by columns,
\begin_inset LatexCommand \index{columns}
\end_inset
separated
\begin_inset LatexCommand \index{separated}
\end_inset
according to the delimiter.
\begin_inset LatexCommand \index{delimiter}
\end_inset
For example
\begin_inset LatexCommand \index{example}
\end_inset
if your file
\begin_inset LatexCommand \index{file}
\end_inset
had lines
\begin_inset LatexCommand \index{lines}
\end_inset
like
\begin_inset Quotes eld
\end_inset
result,somethingelse,somethingelse
\begin_inset Quotes erd
\end_inset
and you only wanted result
\begin_inset LatexCommand \index{result}
\end_inset
you would use:
\begin_deeper
\layout Code
cut -d ',' -f 1 /etc/passwd
\layout Standard
This would get you only the usernames
\begin_inset LatexCommand \index{usernames}
\end_inset
in /etc/passwd
\end_deeper
\layout Itemize
\begin_inset Quotes eld
\end_inset
,
\begin_inset Quotes erd
\end_inset
(commas) --- used to separate
\begin_inset LatexCommand \index{separate}
\end_inset
numbers, these allow
\begin_inset LatexCommand \index{allow}
\end_inset
you to cut
\begin_inset LatexCommand \index{cut}
\end_inset
particular
\begin_inset LatexCommand \index{particular}
\end_inset
columns.
\begin_inset LatexCommand \index{columns}
\end_inset
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\begin_deeper
\layout Code
cut -d ':' -f 1,7 /etc/passwd
\layout Standard
This would only show
\begin_inset LatexCommand \index{show}
\end_inset
the username
\begin_inset LatexCommand \index{username}
\end_inset
and the shell
\begin_inset LatexCommand \index{shell}
\end_inset
that each person
\begin_inset LatexCommand \index{person}
\end_inset
is setup
\begin_inset LatexCommand \index{setup}
\end_inset
for in /etc/passwd.
\end_deeper
\layout Itemize
\begin_inset Quotes eld
\end_inset
-
\begin_inset Quotes erd
\end_inset
(hyphen) --- used to show
\begin_inset LatexCommand \index{show}
\end_inset
from line
\begin_inset LatexCommand \index{line}
\end_inset
x to line
\begin_inset LatexCommand \index{line}
\end_inset
y, for example
\begin_inset LatexCommand \index{example}
\end_inset
1-4, (would be from lines
\begin_inset LatexCommand \index{lines}
\end_inset
1 to line
\begin_inset LatexCommand \index{line}
\end_inset
4).
\begin_deeper
\layout Code
cut -c 1-50 file1.txt
\layout Standard
This would cut
\begin_inset LatexCommand \index{cut}
\end_inset
(display) characters
\begin_inset LatexCommand \index{characters}
\end_inset
(columns) 1 to 50 of each line
\begin_inset LatexCommand \index{line}
\end_inset
(and anything else on that line
\begin_inset LatexCommand \index{line}
\end_inset
is ignored)
\end_deeper
\layout Itemize
-x
\begin_inset LatexCommand \index{-x}
\end_inset
--- where x is a number
\begin_inset LatexCommand \index{number}
\end_inset
to cut
\begin_inset LatexCommand \index{cut}
\end_inset
from line
\begin_inset LatexCommand \index{line}
\end_inset
1 to
\begin_inset Quotes eld
\end_inset
x
\begin_inset Quotes erd
\end_inset
and use x- (where x is a number) to cut
\begin_inset LatexCommand \index{cut}
\end_inset
from
\begin_inset Quotes eld
\end_inset
x
\begin_inset Quotes erd
\end_inset
to the end.
\begin_inset LatexCommand \index{end}
\end_inset
\begin_deeper
\layout Code
cut -5, 20-, 8 file2.txt
\layout Standard
This would display
\begin_inset LatexCommand \index{display}
\end_inset
(
\begin_inset Quotes eld
\end_inset
cut
\begin_inset Quotes erd
\end_inset
) characters
\begin_inset LatexCommand \index{characters}
\end_inset
(columns) 1 to 5, 8 and from 20 to the end.
\begin_inset LatexCommand \index{end}
\end_inset
\end_deeper
\end_deeper
\layout Description
\noindent
ispell/aspell To spell
\begin_inset LatexCommand \index{spell}
\end_inset
check a file
\begin_inset LatexCommand \index{file}
\end_inset
interactively, prompts
\begin_inset LatexCommand \index{prompts}
\end_inset
for you to replace
\begin_inset LatexCommand \index{replace}
\end_inset
word
\begin_inset LatexCommand \index{word}
\end_inset
or continue.
\emph on
aspell
\emph default
is said to be better at suggesting
\begin_inset LatexCommand \index{suggesting}
\end_inset
replacement words,
\begin_inset LatexCommand \index{words}
\end_inset
but its probably
\begin_inset LatexCommand \index{probably}
\end_inset
best to find
\begin_inset LatexCommand \index{find}
\end_inset
out for yourself.
\begin_inset Note
collapsed false
\layout Standard
anyone agree or disagree with this?
\end_inset
\begin_deeper
\layout Standard
\emph on
aspell
\emph default
example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
aspell -c FILE.txt
\layout Standard
This will run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
aspell
\emph default
on a particular
\begin_inset LatexCommand \index{particular}
\end_inset
file called
\begin_inset Quotes eld
\end_inset
FILE.txt
\begin_inset Quotes erd
\end_inset
,
\emph on
apsell
\emph default
will run
\begin_inset LatexCommand \index{run}
\end_inset
interactively and prompt
\begin_inset LatexCommand \index{prompt}
\end_inset
for user
\begin_inset LatexCommand \index{user}
\end_inset
input.
\layout Standard
\emph on
ispell
\emph default
example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
ispell FILE.txt
\layout Standard
This will run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
ispell
\emph default
on a particular
\begin_inset LatexCommand \index{particular}
\end_inset
file called
\begin_inset Quotes eld
\end_inset
FILE.txt
\begin_inset Quotes erd
\end_inset
\emph on
ispell
\emph default
will run
\begin_inset LatexCommand \index{run}
\end_inset
interactively and prompt
\begin_inset LatexCommand \index{prompt}
\end_inset
for user
\begin_inset LatexCommand \index{user}
\end_inset
input.
\end_deeper
\layout Description
\noindent
chcase
\begin_inset LatexCommand \index{chcase}
\end_inset
Is used to change
\begin_inset LatexCommand \index{change}
\end_inset
the uppercase
\begin_inset LatexCommand \index{uppercase}
\end_inset
letters in a file
\begin_inset LatexCommand \index{file}
\end_inset
name to lowercase
\begin_inset LatexCommand \index{lowercase}
\end_inset
(or vice versa).
\begin_deeper
\layout Standard
\noindent
You could also use
\emph on
tr
\emph default
to do the same thing\SpecialChar \ldots{}
\layout Code
\noindent
cat fileName.txt | tr [A-Z] [a-z] > newFileName.txt
\layout Standard
The above would convert
\begin_inset LatexCommand \index{convert}
\end_inset
uppercase
\begin_inset LatexCommand \index{uppercase}
\end_inset
to lowercase
\begin_inset LatexCommand \index{lowercase}
\end_inset
using the the file
\begin_inset LatexCommand \index{file}
\end_inset
\begin_inset Quotes eld
\end_inset
fileName.txt
\begin_inset Quotes erd
\end_inset
as input
\begin_inset LatexCommand \index{input}
\end_inset
and outputting the results
\begin_inset LatexCommand \index{results}
\end_inset
to
\begin_inset Quotes eld
\end_inset
newFileName.txt
\begin_inset Quotes erd
\end_inset
.
\layout Code
\noindent
cat fileName.txt | tr [a-z] [A-Z] > newFileName.txt
\layout Standard
\noindent
The above would convert
\begin_inset LatexCommand \index{convert}
\end_inset
lowercase to uppercase
\begin_inset LatexCommand \index{uppercase}
\end_inset
using the the file
\begin_inset LatexCommand \index{file}
\end_inset
\begin_inset Quotes eld
\end_inset
fileName.txt
\begin_inset Quotes erd
\end_inset
as input
\begin_inset LatexCommand \index{input}
\end_inset
and outputting the results
\begin_inset LatexCommand \index{results}
\end_inset
to
\begin_inset Quotes eld
\end_inset
newFileName.txt
\begin_inset Quotes erd
\end_inset
.
\layout Standard
\noindent
\emph on
chcase
\emph default
(a perl
\begin_inset LatexCommand \index{perl}
\end_inset
script) can be found
\begin_inset LatexCommand \index{found}
\end_inset
at the
\begin_inset LatexCommand \url[chcase homepage.]{https://www.blemished.net/chcase.html}
\end_inset
\layout Standard
\noindent
\begin_inset Note
collapsed false
\layout Standard
don't have any info on how to use this tool\SpecialChar \ldots{}
can also use other tools to do
the same thing.
\end_inset
\end_deeper
\layout Description
\noindent
fmt
\begin_inset LatexCommand \index{fmt}
\end_inset
(format) a simple text
\begin_inset LatexCommand \index{text}
\end_inset
formatter.
Use
\emph on
fmt
\begin_inset LatexCommand \index{fmt}
\end_inset
\emph default
with the
\emph on
-u
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to output
\begin_inset LatexCommand \index{output}
\end_inset
text with "uniform spacing", where the space
\begin_inset LatexCommand \index{space}
\end_inset
between words
\begin_inset LatexCommand \index{words}
\end_inset
is reduced
\begin_inset LatexCommand \index{reduced}
\end_inset
to one space
\begin_inset LatexCommand \index{space}
\end_inset
character
\begin_inset LatexCommand \index{character}
\end_inset
and the space
\begin_inset LatexCommand \index{space}
\end_inset
between sentences
\begin_inset LatexCommand \index{sentences}
\end_inset
is reduced to two space
\begin_inset LatexCommand \index{space}
\end_inset
characters.
\begin_deeper
\layout Standard
\noindent
Example:
\layout Code
fmt -u myessay.txt
\layout Standard
Will make sure the amount
\begin_inset LatexCommand \index{amount}
\end_inset
of space
\begin_inset LatexCommand \index{space}
\end_inset
between sentences
\begin_inset LatexCommand \index{sentences}
\end_inset
is two spaces
\begin_inset LatexCommand \index{spaces}
\end_inset
and the amount
\begin_inset LatexCommand \index{amount}
\end_inset
of space
\begin_inset LatexCommand \index{space}
\end_inset
between words
\begin_inset LatexCommand \index{words}
\end_inset
is one space.
\end_deeper
\layout Description
paste
\begin_inset LatexCommand \index{paste}
\end_inset
Puts lines
\begin_inset LatexCommand \index{lines}
\end_inset
from two files
\begin_inset LatexCommand \index{files}
\end_inset
together, either lines
\begin_inset LatexCommand \index{lines}
\end_inset
of each file
\begin_inset LatexCommand \index{file}
\end_inset
side by side
\begin_inset LatexCommand \index{side}
\end_inset
(normally separated
\begin_inset LatexCommand \index{separated}
\end_inset
by a tab-stop
\begin_inset LatexCommand \index{tab-stop}
\end_inset
but you can have any symbols(s) you like\SpecialChar \ldots{}
) or it can have words
\begin_inset LatexCommand \index{words}
\end_inset
from each file
\begin_inset LatexCommand \index{file}
\end_inset
(the first file
\begin_inset LatexCommand \index{file}
\end_inset
then the second file) side
\begin_inset LatexCommand \index{side}
\end_inset
by side.
\begin_deeper
\layout Standard
To obtain a list
\begin_inset LatexCommand \index{list}
\end_inset
of words
\begin_inset LatexCommand \index{words}
\end_inset
side by side,
\begin_inset LatexCommand \index{side}
\end_inset
the first word
\begin_inset LatexCommand \index{word}
\end_inset
from the first file
\begin_inset LatexCommand \index{file}
\end_inset
on the left
\begin_inset LatexCommand \index{left}
\end_inset
side separated
\begin_inset LatexCommand \index{separated}
\end_inset
by a tab-stop
\begin_inset LatexCommand \index{tab-stop}
\end_inset
then the first word
\begin_inset LatexCommand \index{word}
\end_inset
from the second file
\begin_inset LatexCommand \index{file}
\end_inset
you would type:
\layout Code
paste file1.txt file2.txt
\layout Standard
To have the list
\begin_inset LatexCommand \index{list}
\end_inset
displayed in serial,
\begin_inset LatexCommand \index{serial}
\end_inset
first word
\begin_inset LatexCommand \index{word}
\end_inset
from first file,
\begin_inset LatexCommand \index{file}
\end_inset
[Tab], second word
\begin_inset LatexCommand \index{word}
\end_inset
from first file,
\begin_inset LatexCommand \index{file}
\end_inset
then third and fourth
\begin_inset LatexCommand \index{fourth}
\end_inset
until
\begin_inset LatexCommand \index{until}
\end_inset
the end
\begin_inset LatexCommand \index{end}
\end_inset
of the first file
\begin_inset LatexCommand \index{file}
\end_inset
type:
\layout Code
paste --serial file1.txt file2.txt
\end_deeper
\layout Description
\noindent
expand
\begin_inset LatexCommand \index{expand}
\end_inset
Will convert
\begin_inset LatexCommand \index{convert}
\end_inset
tabs to spaces
\begin_inset LatexCommand \index{spaces}
\end_inset
and output
\begin_inset LatexCommand \index{output}
\end_inset
it.
Use the option
\begin_inset LatexCommand \index{option}
\end_inset
\emph on
-t
\begin_inset LatexCommand \index{-t}
\end_inset
num
\emph default
to specify
\begin_inset LatexCommand \index{specify}
\end_inset
the size
\begin_inset LatexCommand \index{size}
\end_inset
of a
\begin_inset Quotes eld
\end_inset
tapstop
\begin_inset Quotes erd
\end_inset
, the number
\begin_inset LatexCommand \index{number}
\end_inset
of characters
\begin_inset LatexCommand \index{characters}
\end_inset
between each tab.
\begin_inset LatexCommand \index{tab}
\end_inset
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
expand file_name.txt
\end_deeper
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
expand/unexpand kept for completeness but are candidates for removal, I
can see they would likely be useful for programmers though\SpecialChar \ldots{}
\end_inset
\layout Description
\noindent
unexpand
\begin_inset LatexCommand \index{unexpand}
\end_inset
Will convert
\begin_inset LatexCommand \index{convert}
\end_inset
spaces to tabs
\begin_inset LatexCommand \index{tabs}
\end_inset
and output
\begin_inset LatexCommand \index{output}
\end_inset
it.
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
unexpand file_name.txt
\end_deeper
\layout Description
\noindent
uniq
\begin_inset LatexCommand \index{uniq}
\end_inset
Eliminates duplicate
\begin_inset LatexCommand \index{duplicate}
\end_inset
entries from a file
\begin_inset LatexCommand \index{file}
\end_inset
and it sometimes greatly
\begin_inset LatexCommand \index{greatly}
\end_inset
simplifies the display.
\begin_inset LatexCommand \index{display}
\end_inset
\begin_deeper
\layout Standard
\noindent
\emph on
uniq
\emph default
options:
\begin_inset LatexCommand \index{options}
\end_inset
\layout Itemize
\noindent
\emph on
-c
\emph default
--- count
\begin_inset LatexCommand \index{count}
\end_inset
the number
\begin_inset LatexCommand \index{number}
\end_inset
of occurances
\begin_inset LatexCommand \index{occurances}
\end_inset
of each duplicate
\begin_inset LatexCommand \index{duplicate}
\end_inset
\emph on
\layout Itemize
\noindent
\emph on
-u
\begin_inset LatexCommand \index{-u}
\end_inset
\emph default
--- list
\begin_inset LatexCommand \index{list}
\end_inset
only unique
\begin_inset LatexCommand \index{unique}
\end_inset
entries
\layout Itemize
\noindent
\emph on
-d
\begin_inset LatexCommand \index{-d}
\end_inset
\emph default
--- list
\begin_inset LatexCommand \index{list}
\end_inset
only duplicate
\begin_inset LatexCommand \index{duplicate}
\end_inset
entries
\layout Standard
\noindent
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
uniq -cd phone_list.txt
\layout Standard
This would display
\begin_inset LatexCommand \index{display}
\end_inset
any duplicate
\begin_inset LatexCommand \index{duplicate}
\end_inset
entries only and a count
\begin_inset LatexCommand \index{count}
\end_inset
of the number
\begin_inset LatexCommand \index{number}
\end_inset
of times
\begin_inset LatexCommand \index{times}
\end_inset
that entry
\begin_inset LatexCommand \index{entry}
\end_inset
has appeared.
\end_deeper
\layout Description
\noindent
tr
\begin_inset LatexCommand \index{tr}
\end_inset
(translation).
A filter
\begin_inset LatexCommand \index{filter}
\end_inset
useful to replace
\begin_inset LatexCommand \index{replace}
\end_inset
all instances
\begin_inset LatexCommand \index{instances}
\end_inset
of characters
\begin_inset LatexCommand \index{characters}
\end_inset
in a text
\begin_inset LatexCommand \index{text}
\end_inset
file or "squeeze"
\begin_inset LatexCommand \index{squeeze}
\end_inset
the white
\begin_inset LatexCommand \index{white}
\end_inset
space.
\begin_deeper
\layout Standard
\noindent
Example:
\layout Code
\noindent
cat some_file | tr 3 5 > new_file
\layout Standard
\noindent
This will run
\begin_inset LatexCommand \index{run}
\end_inset
the
\emph on
cat
\emph default
program
\begin_inset LatexCommand \index{program}
\end_inset
on some file,
\begin_inset LatexCommand \index{file}
\end_inset
the output
\begin_inset LatexCommand \index{output}
\end_inset
of this command
\begin_inset LatexCommand \index{command}
\end_inset
will be sent to the
\emph on
tr
\emph default
command,
\begin_inset LatexCommand \index{command}
\end_inset
\emph on
tr
\emph default
will replace
\begin_inset LatexCommand \index{replace}
\end_inset
all the instances
\begin_inset LatexCommand \index{instances}
\end_inset
of 3 with 5, like a search
\begin_inset LatexCommand \index{search}
\end_inset
and replace.
You can also do other things such as:
\layout Code
cat some_file | tr [A-Z] [a-z] > new_file
\layout Standard
This will run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
cat
\emph default
on some_file
\begin_inset LatexCommand \index{some_file}
\end_inset
and convert
\begin_inset LatexCommand \index{convert}
\end_inset
any capital
\begin_inset LatexCommand \index{capital}
\end_inset
letters to lowercase
\begin_inset LatexCommand \index{lowercase}
\end_inset
letters (you could use this to change the case of file names too\SpecialChar \ldots{}
).
\layout SGML
\layout SGML
Alternatives
\layout SGML
\layout SGML
You can also do a search and replace with a one line Perl command, read
about it at the end of this section.
\layout SGML
\layout SGML
\end_deeper
\layout Description
nl
\begin_inset LatexCommand \index{nl}
\end_inset
The number
\begin_inset LatexCommand \index{number}
\end_inset
lines
\begin_inset LatexCommand \index{lines}
\end_inset
tool,
\begin_inset LatexCommand \index{tool}
\end_inset
it's default
\begin_inset LatexCommand \index{default}
\end_inset
action
\begin_inset LatexCommand \index{action}
\end_inset
is to write
\begin_inset LatexCommand \index{write}
\end_inset
it's input
\begin_inset LatexCommand \index{input}
\end_inset
(either the file
\begin_inset LatexCommand \index{file}
\end_inset
names given as an argument,
\begin_inset LatexCommand \index{argument}
\end_inset
or the standard
\begin_inset LatexCommand \index{standard}
\end_inset
input) to the standard output.
\begin_inset LatexCommand \index{output}
\end_inset
\begin_deeper
\layout Standard
Line
\begin_inset LatexCommand \index{Line}
\end_inset
numbers are added to every line
\begin_inset LatexCommand \index{line}
\end_inset
and the text
\begin_inset LatexCommand \index{text}
\end_inset
is indented.
\begin_inset LatexCommand \index{indented}
\end_inset
\layout Standard
This command
\begin_inset LatexCommand \index{command}
\end_inset
can do take
\begin_inset LatexCommand \index{take}
\end_inset
some more
\begin_inset LatexCommand \index{more}
\end_inset
advanced
\begin_inset LatexCommand \index{advanced}
\end_inset
numbering
\begin_inset LatexCommand \index{numbering}
\end_inset
options, simply read
\begin_inset LatexCommand \index{read}
\end_inset
the info
\begin_inset LatexCommand \index{info}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
on it.
\layout Standard
These advanced
\begin_inset LatexCommand \index{advanced}
\end_inset
options
\begin_inset LatexCommand \index{options}
\end_inset
mainly relate to customisation
\begin_inset LatexCommand \index{customisation}
\end_inset
of the numbering,
\begin_inset LatexCommand \index{numbering}
\end_inset
including
\begin_inset LatexCommand \index{including}
\end_inset
different forms
\begin_inset LatexCommand \index{forms}
\end_inset
of separation
\begin_inset LatexCommand \index{separation}
\end_inset
for sections/pages/footers etc.
\layout Standard
Also try
\begin_inset LatexCommand \index{try}
\end_inset
\emph on
cat
\begin_inset LatexCommand \index{cat}
\end_inset
-n
\begin_inset LatexCommand \index{-n}
\end_inset
\emph default
(number all lines) or
\emph on
cat
\begin_inset LatexCommand \index{cat}
\end_inset
-b
\emph default
(number all non-blank
\begin_inset LatexCommand \index{non-blank}
\end_inset
lines).
For more
\begin_inset LatexCommand \index{more}
\end_inset
info
\begin_inset LatexCommand \index{info}
\end_inset
on
\emph on
cat
\emph default
check
\begin_inset LatexCommand \index{check}
\end_inset
under this section:
\begin_inset LatexCommand \index{section}
\end_inset
\begin_inset LatexCommand \ref{text-viewing-tools}
\end_inset
\layout Standard
There are two ways you can use
\emph on
nl
\emph default
:
\layout Code
nl some_text_file.txt
\layout Standard
The above command
\begin_inset LatexCommand \index{command}
\end_inset
would add
\begin_inset LatexCommand \index{add}
\end_inset
numbers to each line
\begin_inset LatexCommand \index{line}
\end_inset
of some_text_file.
\begin_inset LatexCommand \index{some_text_file}
\end_inset
You could use
\emph on
nl
\emph default
to number
\begin_inset LatexCommand \index{number}
\end_inset
the output
\begin_inset LatexCommand \index{output}
\end_inset
of something as shown
\begin_inset LatexCommand \index{shown}
\end_inset
in the example
\begin_inset LatexCommand \index{example}
\end_inset
below;
\layout Code
grep some_string some_file | nl
\end_deeper
\layout Description
\noindent
Perl\SpecialChar ~
search\SpecialChar ~
and\SpecialChar ~
replace\SpecialChar ~
text
\begin_inset LatexCommand \index{text}
\end_inset
To search
\begin_inset LatexCommand \index{search}
\end_inset
and replace
\begin_inset LatexCommand \index{replace}
\end_inset
text in a file
\begin_inset LatexCommand \index{file}
\end_inset
is to use the following
\begin_inset LatexCommand \index{following}
\end_inset
one-line
\begin_inset LatexCommand \index{one-line}
\end_inset
Perl command
\begin_inset LatexCommand \index{command}
\end_inset
\begin_inset Foot
collapsed true
\layout Standard
This information has been taken from the Linux Cookbook (without editing).
See [3] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
:
\begin_deeper
\layout Code
\noindent
$ perl -pi -e "s/oldstring/newstring/g;" filespec [RET]
\layout Standard
\noindent
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
In this example,
\begin_inset LatexCommand \index{example}
\end_inset
\family default
\begin_inset LatexCommand \index{default}
\end_inset
\emph on
oldstring
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
\emph default
is the string
\begin_inset LatexCommand \index{string}
\end_inset
to search,
\begin_inset LatexCommand \index{search}
\end_inset
\family default
\begin_inset LatexCommand \index{default}
\end_inset
\emph on
newstring
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
\emph default
is the string
\begin_inset LatexCommand \index{string}
\end_inset
to replace
\begin_inset LatexCommand \index{replace}
\end_inset
it with, and
\family default
\begin_inset LatexCommand \index{default}
\end_inset
\emph on
filespec
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
\emph default
is the name of the file
\begin_inset LatexCommand \index{file}
\end_inset
or files
\begin_inset LatexCommand \index{files}
\end_inset
to work
\begin_inset LatexCommand \index{work}
\end_inset
on.
You can use this for more
\begin_inset LatexCommand \index{more}
\end_inset
than one file.
\begin_inset LatexCommand \index{file}
\end_inset
\layout Standard
Example:
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
To replace
\begin_inset LatexCommand \index{replace}
\end_inset
the string
\begin_inset LatexCommand \index{string}
\end_inset
`helpless' with the string
\begin_inset LatexCommand \index{string}
\end_inset
`helpful' in all files
\begin_inset LatexCommand \index{files}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory,
\begin_inset LatexCommand \index{directory}
\end_inset
type:
\layout Code
$ perl -pi -e "s/helpless/helpful/g;" * [RET]
\layout Standard
\family roman
\begin_inset LatexCommand \index{roman}
\end_inset
Also try
\begin_inset LatexCommand \index{try}
\end_inset
using
\emph on
tr
\emph default
to do the same thing (see further above in this section).
\end_deeper
\layout SGML
\layout SGML
If these tools are too primitive
\layout SGML
If these text tools are too simple for your purposes then you are
probably looking at doing some programming or scripting.
\layout SGML
If you would like more information on bash scripting then please see
the
\begin_inset LatexCommand \url[advanced bash scripting guide]{https://www.tldp.org/LDP/abs/html/}
\end_inset
, authored by Mendel Cooper.
\layout SGML
sed and awk are traditional UNIX system tools for working with text,
this guide does not provide an explanation of them.
sed works on a line-by-line basis performing substitution and awk can perform
a similar task or assist by working on a file and printing out certain
information (its a programming language).
\layout SGML
You will normally find them installed on your GNU/Linux system and
will find many tutorials all over the internet, feel free to look them
up if you ever have to perform many similar operations on a text file.
\layout SGML
\layout Section
Text Conversion/Filter Tools
\begin_inset LatexCommand \label{text-filter-tools}
\end_inset
\layout Description
Filters\SpecialChar ~
\series bold
(UNIX
\series default
\SpecialChar ~
\series bold
System/dos
\series default
\SpecialChar ~
\series bold
formats)
\series default
\begin_inset LatexCommand \label{text-filters-unix-dos}
\end_inset
The following
\begin_inset LatexCommand \index{following}
\end_inset
filters
\begin_inset LatexCommand \index{filters}
\end_inset
allow you to change
\begin_inset LatexCommand \index{change}
\end_inset
text from Dos-style
\begin_inset LatexCommand \index{Dos-style}
\end_inset
to UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
style
\begin_inset LatexCommand \index{style}
\end_inset
and vice-versa,
\begin_inset LatexCommand \index{vice-versa}
\end_inset
or convert
\begin_inset LatexCommand \index{convert}
\end_inset
a file
\begin_inset LatexCommand \index{file}
\end_inset
to other formats.
\begin_inset LatexCommand \index{formats}
\end_inset
Also note that many modern text editors can do this for you\SpecialChar \ldots{}
\begin_deeper
\layout Description
Why\SpecialChar ~
use\SpecialChar ~
filters? Because UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
systems and Microsoft
\begin_inset LatexCommand \index{Microsoft}
\end_inset
use two different
\begin_inset LatexCommand \index{different}
\end_inset
standards
\begin_inset LatexCommand \index{standards}
\end_inset
to represent
\begin_inset LatexCommand \index{represent}
\end_inset
the end-of-line
\begin_inset LatexCommand \index{end-of-line}
\end_inset
in an ASCII
\begin_inset LatexCommand \index{ASCII}
\end_inset
text file.
\begin_inset LatexCommand \index{file}
\end_inset
\begin_deeper
\layout Standard
This can sometimes causes
\begin_inset LatexCommand \index{causes}
\end_inset
problems
\begin_inset LatexCommand \index{problems}
\end_inset
in editors
\begin_inset LatexCommand \index{editors}
\end_inset
or viewers
\begin_inset LatexCommand \index{viewers}
\end_inset
which aren't familiar
\begin_inset LatexCommand \index{familiar}
\end_inset
with the other operating
\begin_inset LatexCommand \index{operating}
\end_inset
systems
\begin_inset LatexCommand \index{systems}
\end_inset
end-of-line
\begin_inset LatexCommand \index{end-of-line}
\end_inset
style.
The following
\begin_inset LatexCommand \index{following}
\end_inset
tools
\begin_inset LatexCommand \index{tools}
\end_inset
allow you to get around this difference.
\begin_inset LatexCommand \index{difference}
\end_inset
\end_deeper
\layout Description
Whats\SpecialChar ~
the\SpecialChar ~
difference? The difference
\begin_inset LatexCommand \index{difference}
\end_inset
is very simple, on a Windows
\begin_inset LatexCommand \index{Windows}
\end_inset
text file,
\begin_inset LatexCommand \index{file}
\end_inset
a newline
\begin_inset LatexCommand \index{newline}
\end_inset
is signalled
\begin_inset LatexCommand \index{signalled}
\end_inset
by a carriage
\begin_inset LatexCommand \index{carriage}
\end_inset
return
\begin_inset LatexCommand \index{return}
\end_inset
followed by a newline, '
\backslash
r
\backslash
n' in ASCII.
\begin_inset LatexCommand \index{ASCII}
\end_inset
\begin_deeper
\layout Standard
On a UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
a newline
\begin_inset LatexCommand \index{newline}
\end_inset
is simply a newline, '
\backslash
n' in ASCII.
\begin_inset LatexCommand \index{ASCII}
\end_inset
\end_deeper
\end_deeper
\layout Description
dos2unix
\begin_inset LatexCommand \index{dos2unix}
\end_inset
This converts
\begin_inset LatexCommand \index{converts}
\end_inset
Microsoft-style end-of-line
\begin_inset LatexCommand \index{end-of-line}
\end_inset
characters to UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
style
\begin_inset LatexCommand \index{style}
\end_inset
end
\begin_inset LatexCommand \index{end}
\end_inset
of line
\begin_inset LatexCommand \index{line}
\end_inset
characters.
\begin_deeper
\layout Standard
Simply type:
\layout Code
dos2unix file.txt
\end_deeper
\layout Description
fromdos
\begin_inset LatexCommand \index{fromdos}
\end_inset
This does the same as
\emph on
dos2unix
\begin_inset LatexCommand \index{dos2unix}
\end_inset
\emph default
(above).
\begin_deeper
\layout Standard
Simply type:
\layout Code
fromdos file.txt
\layout Standard
\emph on
fromdos
\emph default
can be obtained from
\begin_inset LatexCommand \url[the from/to dos website.]{https://www.thefreecountry.com/tofrodos/}
\end_inset
\end_deeper
\layout Description
unix2dos
\begin_inset LatexCommand \index{unix2dos}
\end_inset
This converts
\begin_inset LatexCommand \index{converts}
\end_inset
UNIX system
\begin_inset LatexCommand \index{system}
\end_inset
style end
\begin_inset LatexCommand \index{end}
\end_inset
of line
\begin_inset LatexCommand \index{line}
\end_inset
characters to Microsoft-sty le
\begin_inset LatexCommand \index{le}
\end_inset
end-of-line characters.
\begin_inset LatexCommand \index{characters}
\end_inset
\begin_deeper
\layout Standard
Simply type:
\layout Code
unix2dos file.txt
\end_deeper
\layout Description
todos
\begin_inset LatexCommand \index{todos}
\end_inset
This does the same as
\emph on
unix2dos
\emph default
(above).
\begin_deeper
\layout Standard
Simply type:
\layout Code
todos file.txt
\layout Standard
\emph on
todos
\emph default
can be obtained from
\begin_inset LatexCommand \url[the from/to dos website.]{https://www.thefreecountry.com/tofrodos/}
\end_inset
\end_deeper
\layout Description
antiword
\begin_inset LatexCommand \index{antiword}
\end_inset
This filter
\begin_inset LatexCommand \index{filter}
\end_inset
converts
\begin_inset LatexCommand \index{converts}
\end_inset
Microsoft word
\begin_inset LatexCommand \index{word}
\end_inset
documents into plain
\begin_inset LatexCommand \index{plain}
\end_inset
ASCII text
\begin_inset LatexCommand \index{text}
\end_inset
documents.
\begin_inset LatexCommand \index{documents}
\end_inset
\begin_deeper
\layout Standard
Simply type:
\layout Code
antiword file.doc
\layout Standard
You can get
\emph on
antiword
\emph default
from
\begin_inset LatexCommand \url[the antiword homepage.]{https://www.winfield.demon.nl/}
\end_inset
\end_deeper
\layout Description
recode
\begin_inset LatexCommand \index{recode}
\end_inset
Converts
\begin_inset LatexCommand \index{Converts}
\end_inset
text files
\begin_inset LatexCommand \index{files}
\end_inset
between various formats
\begin_inset LatexCommand \index{formats}
\end_inset
including HTML
\begin_inset LatexCommand \index{HTML}
\end_inset
and dozens
\begin_inset LatexCommand \index{dozens}
\end_inset
of different
\begin_inset LatexCommand \index{different}
\end_inset
forms of text
\begin_inset LatexCommand \index{text}
\end_inset
encodings.
\begin_inset LatexCommand \index{encodings}
\end_inset
\begin_deeper
\layout Standard
Use
\emph on
recode
\begin_inset LatexCommand \index{recode}
\end_inset
-l
\emph default
for a full
\begin_inset LatexCommand \index{full}
\end_inset
listing.
\begin_inset LatexCommand \index{listing}
\end_inset
It can also be used to convert
\begin_inset LatexCommand \index{convert}
\end_inset
text to and from Windows
\begin_inset LatexCommand \index{Windows}
\end_inset
and UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
formats
\begin_inset LatexCommand \index{formats}
\end_inset
(so you don't get the weird
\begin_inset LatexCommand \index{weird}
\end_inset
symbols).
\layout SGML
\noindent
\layout SGML
\noindent
Warning
\layout SGML
\noindent
\layout SGML
\noindent
By default recode overwrites the input file, use '<' to use recode as a
filter only (and to not overwrite the file).
\layout SGML
\noindent
\layout SGML
\noindent
\layout Description
\noindent
\series medium
Examples:
\layout Standard
UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
text to Windows
\begin_inset LatexCommand \index{Windows}
\end_inset
text:
\layout Code
\noindent
recode ..pc file_name
\layout Standard
Windows
\begin_inset LatexCommand \index{Windows}
\end_inset
text to UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
text:
\layout Code
recode ..pc/ file_name
\layout Standard
UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
Text to Windows
\begin_inset LatexCommand \index{Windows}
\end_inset
Text without overwriting
\begin_inset LatexCommand \index{overwriting}
\end_inset
the original
\begin_inset LatexCommand \index{original}
\end_inset
file (and creating a new
\begin_inset LatexCommand \index{new}
\end_inset
output file):
\layout Code
\noindent
recode ..pc < file_name > recoded_file
\end_deeper
\layout Description
tr
\begin_inset LatexCommand \index{tr}
\end_inset
(Windows to UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
style conversion
\begin_inset LatexCommand \index{conversion}
\end_inset
only).
While
\emph on
tr
\emph default
is not specifically
\begin_inset LatexCommand \index{specifically}
\end_inset
designed to convert
\begin_inset LatexCommand \index{convert}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
from Windows-format
\begin_inset LatexCommand \index{Windows-format}
\end_inset
to UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
format
\begin_inset LatexCommand \index{format}
\end_inset
by doing:
\begin_deeper
\layout Code
tr -d '
\backslash
r' < inputFile.txt > outputFile.txt
\layout Standard
The -d
\begin_inset LatexCommand \index{-d}
\end_inset
switch means to simply delete
\begin_inset LatexCommand \index{delete}
\end_inset
any occurances
\begin_inset LatexCommand \index{occurances}
\end_inset
of the string.
\begin_inset LatexCommand \index{string}
\end_inset
Since we are looking
\begin_inset LatexCommand \index{looking}
\end_inset
for '
\backslash
r', carriage
\begin_inset LatexCommand \index{carriage}
\end_inset
returns
\begin_inset LatexCommand \index{returns}
\end_inset
it will remove
\begin_inset LatexCommand \index{remove}
\end_inset
any it finds,
\begin_inset LatexCommand \index{finds}
\end_inset
making the file
\begin_inset LatexCommand \index{file}
\end_inset
a UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system text file\SpecialChar \ldots{}
\end_deeper
\layout Subsection
Conversion tools
\begin_inset LatexCommand \label{text-conversion-tools}
\end_inset
\layout Description
enscript
\begin_inset LatexCommand \index{enscript}
\end_inset
Converts
\begin_inset LatexCommand \index{Converts}
\end_inset
text files
\begin_inset LatexCommand \index{files}
\end_inset
to postscript,
\begin_inset LatexCommand \index{postscript}
\end_inset
rtf,
\begin_inset LatexCommand \index{rtf}
\end_inset
HTML
\begin_inset LatexCommand \index{HTML}
\end_inset
(use
\emph on
ghostview
\emph default
to view
\begin_inset LatexCommand \index{view}
\end_inset
the postscript
\begin_inset LatexCommand \index{postscript}
\end_inset
file).
\emph on
enscript
\emph default
has a large number
\begin_inset LatexCommand \index{number}
\end_inset
of options
\begin_inset LatexCommand \index{options}
\end_inset
which can be used to customise
\begin_inset LatexCommand \index{customise}
\end_inset
the output.
\begin_inset LatexCommand \index{output}
\end_inset
\begin_deeper
\layout Standard
Examples:
\begin_inset Foot
collapsed false
\layout Standard
These examples are based off information from the enscript manual page,
see [12] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
\layout Code
enscript --language=html input_file.txt -o output_file.html
\layout Standard
This will take
\begin_inset LatexCommand \index{take}
\end_inset
some file
\begin_inset LatexCommand \index{file}
\end_inset
and output
\begin_inset LatexCommand \index{output}
\end_inset
it as a html
\begin_inset LatexCommand \index{html}
\end_inset
file.
\layout Code
enscript --help-highlight
\layout Standard
Display
\begin_inset LatexCommand \index{Display}
\end_inset
help on using the highlight
\begin_inset LatexCommand \index{highlight}
\end_inset
feature (list all different
\begin_inset LatexCommand \index{different}
\end_inset
types
\begin_inset LatexCommand \index{types}
\end_inset
of highlighting
\begin_inset LatexCommand \index{highlighting}
\end_inset
available)
\layout Code
-E[lang]
\layout Standard
Highlight
\begin_inset LatexCommand \index{Highlight}
\end_inset
using the lang
\begin_inset LatexCommand \index{lang}
\end_inset
(pretty print), example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
enscript -E --color --language=html --toc -pfoo.html *.h *.c
\layout Standard
Add
\begin_inset LatexCommand \index{Add}
\end_inset
all the files
\begin_inset LatexCommand \index{files}
\end_inset
with a .h
\begin_inset LatexCommand \index{.h}
\end_inset
and a .c (C source
\begin_inset LatexCommand \index{source}
\end_inset
and header
\begin_inset LatexCommand \index{header}
\end_inset
files) into a file
\begin_inset LatexCommand \index{file}
\end_inset
called foo.
\begin_inset LatexCommand \index{foo}
\end_inset
html, use colour
\begin_inset LatexCommand \index{colour}
\end_inset
and add
\begin_inset LatexCommand \index{add}
\end_inset
a table
\begin_inset LatexCommand \index{table}
\end_inset
of contents
\begin_inset LatexCommand \index{contents}
\end_inset
\layout Standard
For further options
\begin_inset LatexCommand \index{options}
\end_inset
refer to the well written
\begin_inset LatexCommand \index{written}
\end_inset
manual page
\begin_inset LatexCommand \index{page}
\end_inset
of enscript.
\begin_inset LatexCommand \index{enscript}
\end_inset
\end_deeper
\layout Description
\noindent
figlet
\begin_inset LatexCommand \index{figlet}
\end_inset
Used to create ASCII
\begin_inset LatexCommand \index{ASCII}
\end_inset
\begin_inset Quotes eld
\end_inset
art
\begin_inset Quotes erd
\end_inset
.
Figlet
\begin_inset LatexCommand \index{Figlet}
\end_inset
can create several
\begin_inset LatexCommand \index{several}
\end_inset
different
\begin_inset LatexCommand \index{different}
\end_inset
forms (fonts) of ASCII
\begin_inset LatexCommand \index{ASCII}
\end_inset
art,
\begin_inset LatexCommand \index{art}
\end_inset
its one of the more
\begin_inset LatexCommand \index{more}
\end_inset
unusual
\begin_inset LatexCommand \index{unusual}
\end_inset
programs
\begin_inset LatexCommand \index{programs}
\end_inset
around.
\layout Section
Finding Text Within Files
\begin_inset LatexCommand \label{finding-text-within-files}
\end_inset
\layout Description
grep
\begin_inset LatexCommand \index{grep}
\end_inset
Looks for text
\begin_inset LatexCommand \index{text}
\end_inset
within files.
\begin_inset LatexCommand \index{files}
\end_inset
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\begin_deeper
\layout Code
\emph on
grep this_word this_file.txt
\emph default
\layout Standard
Example
\begin_inset LatexCommand \index{Example}
\end_inset
options:
\begin_inset LatexCommand \index{options}
\end_inset
\layout Itemize
\emph on
-v
\emph default
--- this option
\begin_inset LatexCommand \index{option}
\end_inset
is used to display
\begin_inset LatexCommand \index{display}
\end_inset
lines
\begin_inset LatexCommand \index{lines}
\end_inset
which do not contain the string.
\begin_inset LatexCommand \index{string}
\end_inset
\layout Itemize
\emph on
-n
\emph default
--- this option
\begin_inset LatexCommand \index{option}
\end_inset
displays the line
\begin_inset LatexCommand \index{line}
\end_inset
numbers
\layout Itemize
\emph on
-w
\emph default
--- this option
\begin_inset LatexCommand \index{option}
\end_inset
makes grep
\begin_inset LatexCommand \index{grep}
\end_inset
match the whole word
\begin_inset LatexCommand \index{word}
\end_inset
\layout Itemize
\emph on
-A x
\emph default
or
\emph on
-B
\emph default
x (where x is a number) --- display
\begin_inset LatexCommand \index{display}
\end_inset
\begin_inset Quotes eld
\end_inset
x
\begin_inset Quotes erd
\end_inset
lines
\begin_inset LatexCommand \index{lines}
\end_inset
\series bold
A
\series default
fter or
\series bold
B
\series default
efore the section
\begin_inset LatexCommand \index{section}
\end_inset
where the particular
\begin_inset LatexCommand \index{particular}
\end_inset
word
\begin_inset LatexCommand \index{word}
\end_inset
is found.
\begin_inset LatexCommand \index{found}
\end_inset
\layout Itemize
\emph on
-r
\emph default
or
\emph on
rgrep
\emph default
--- search
\begin_inset LatexCommand \index{search}
\end_inset
for text
\begin_inset LatexCommand \index{text}
\end_inset
within files
\begin_inset LatexCommand \index{files}
\end_inset
recursively.
\layout Standard
This command
\begin_inset LatexCommand \index{command}
\end_inset
uses regular
\begin_inset LatexCommand \index{regular}
\end_inset
expressions, for more
\begin_inset LatexCommand \index{more}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
please see,
\begin_inset LatexCommand \ref{regular-expressions}
\end_inset
.
\layout Standard
For example,
\begin_inset LatexCommand \index{example}
\end_inset
this command
\begin_inset LatexCommand \index{command}
\end_inset
would look
\begin_inset LatexCommand \index{look}
\end_inset
in the file
\begin_inset LatexCommand \index{file}
\end_inset
\begin_inset Quotes eld
\end_inset
rpmlist.txt
\begin_inset Quotes erd
\end_inset
for anything starting
\begin_inset LatexCommand \index{starting}
\end_inset
with
\begin_inset Quotes eld
\end_inset
rpm
\begin_inset Quotes erd
\end_inset
:
\layout Code
grep rpm rpmlist.txt
\layout Standard
Or you could use it like this, to search
\begin_inset LatexCommand \index{search}
\end_inset
through the output
\begin_inset LatexCommand \index{output}
\end_inset
of another file:
\begin_inset LatexCommand \index{file}
\end_inset
\layout Code
rpm -qa | grep ogg
\layout Standard
The first command
\begin_inset LatexCommand \index{command}
\end_inset
lists
\begin_inset LatexCommand \index{lists}
\end_inset
all RPM's installed
\begin_inset LatexCommand \index{installed}
\end_inset
on your system,
\begin_inset LatexCommand \index{system}
\end_inset
the second finds
\begin_inset LatexCommand \index{finds}
\end_inset
any containing the string
\begin_inset LatexCommand \index{string}
\end_inset
\begin_inset Quotes eld
\end_inset
ogg
\begin_inset Quotes erd
\end_inset
and outputs
\begin_inset LatexCommand \index{outputs}
\end_inset
them.
\end_deeper
\layout Description
\noindent
rgrep
\begin_inset LatexCommand \index{rgrep}
\end_inset
A "recursive"
\begin_inset LatexCommand \index{recursive}
\end_inset
version
\begin_inset LatexCommand \index{version}
\end_inset
of
\emph on
grep
\emph default
(this is a different
\begin_inset LatexCommand \index{different}
\end_inset
program to
\emph on
grep
\emph default
).
This will search
\begin_inset LatexCommand \index{search}
\end_inset
all the files
\begin_inset LatexCommand \index{files}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
and all it's subdirectories and print
\begin_inset LatexCommand \index{print}
\end_inset
the names of the files
\begin_inset LatexCommand \index{files}
\end_inset
and the matching
\begin_inset LatexCommand \index{matching}
\end_inset
line.
\begin_inset LatexCommand \index{line}
\end_inset
Follows
\begin_inset LatexCommand \index{Follows}
\end_inset
similar syntax
\begin_inset LatexCommand \index{syntax}
\end_inset
to
\emph on
grep
\emph default
(see above).
You could also use
\emph on
grep
\emph default
with the
\emph on
-r
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to achieve the same affect.
\begin_inset LatexCommand \index{affect}
\end_inset
\layout Description
fgrep
\begin_inset LatexCommand \index{fgrep}
\end_inset
This version
\begin_inset LatexCommand \index{version}
\end_inset
of
\emph on
grep
\emph default
calls
\begin_inset LatexCommand \index{calls}
\end_inset
\emph on
grep
\emph default
with the
\emph on
-F
\emph default
option.
\begin_inset LatexCommand \index{option}
\end_inset
This will look
\begin_inset LatexCommand \index{look}
\end_inset
for literal
\begin_inset LatexCommand \index{literal}
\end_inset
strings only, it won't use or expand
\begin_inset LatexCommand \index{expand}
\end_inset
any kind
\begin_inset LatexCommand \index{kind}
\end_inset
of regular
\begin_inset LatexCommand \index{regular}
\end_inset
expression.
\begin_deeper
\layout Standard
For example
\begin_inset LatexCommand \index{example}
\end_inset
you could type:
\layout Code
fgrep a$*b? file.txt
\layout Standard
And
\emph on
fgrep
\emph default
would look
\begin_inset LatexCommand \index{look}
\end_inset
for the string
\begin_inset LatexCommand \index{string}
\end_inset
\begin_inset Quotes eld
\end_inset
a$*b?
\begin_inset Quotes erd
\end_inset
in the file
\begin_inset LatexCommand \index{file}
\end_inset
\begin_inset Quotes eld
\end_inset
file.txt
\begin_inset Quotes erd
\end_inset
.
\end_deeper
\layout SGML
\layout SGML
Other Versions
\layout SGML
\layout SGML
There are various versions of grep which are designed to do different things
try searching for them on the internet or within your distribution.
\layout SGML
\layout SGML
\layout Chapter
Mathematical tools
\begin_inset LatexCommand \label{Mathematical-tools}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Description
factor Calculates and outputs the prime factors of numbers passed as arguments.
\begin_deeper
\layout Standard
Command syntax:
\layout Code
factor number1 number2 number3
\layout Standard
This will output factors of the first, second and third numbers (you can
do just one number or several numbers\SpecialChar \ldots{}
) with one number's factor(s) per
line.
\layout SGML
\layout SGML
Note:
\layout SGML
\layout SGML
Please note that this tool is part of the num-utils package.
\layout SGML
\layout SGML
\end_deeper
\layout Standard
seq Print a list of numbers (line-by-line).
This is usually more useful in programming than in normal usage\SpecialChar \ldots{}
\layout Standard
Command syntax:
\layout Code
seq starting_number ending_number
\begin_deeper
\layout Standard
This will print numbers from the
\begin_inset Quotes eld
\end_inset
starting_number
\begin_inset Quotes erd
\end_inset
till the
\begin_inset Quotes eld
\end_inset
ending_number
\begin_inset Quotes erd
\end_inset
with one number on each line.
\end_deeper
\layout Description
range Similar to
\emph on
seq
\emph default
.
The basic syntax is the same as
\emph on
seq
\emph default
(above).
\begin_deeper
\layout SGML
\layout SGML
Note:
\layout SGML
\layout SGML
Please note that this tool is part of the num-utils package.
\layout SGML
\layout SGML
\end_deeper
\layout Description
average Find the median, mode, or average of a set of numbers.
The numbers can come from standard input or from a file.
\begin_deeper
\layout Standard
For example, to input from standard input you could simply type:
\layout Code
average
\layout Standard
To input from a file you would type:
\layout Code
average file_name
\layout SGML
\layout SGML
Note:
\layout SGML
\layout SGML
Please note that this tool is part of the num-utils package.
\layout SGML
\layout SGML
\end_deeper
\layout Description
bound Find the minimum and/or maximum of a set of numbers.
The numbers can come from standard input or from a file.
\begin_deeper
\layout Standard
For example, to input from standard input you could simply type:
\layout Code
bound
\layout Standard
To input from a file you would type:
\layout Code
bound file_name
\layout SGML
\layout SGML
Note:
\layout SGML
\layout SGML
Please note that this tool is part of the num-utils package.
\layout SGML
\layout SGML
\end_deeper
\layout Description
interval Find the difference between numbers (by default it will show the
difference between each line).
\begin_deeper
\layout Standard
For example, to input from standard input you could simply type:
\layout Code
interval
\layout Standard
To input from a file you would type:
\layout Code
interval file_name
\layout SGML
\layout SGML
Note:
\layout SGML
\layout SGML
Please note that this tool is part of the num-utils package.
\layout SGML
\layout SGML
\end_deeper
\layout Description
numsum Find the result of adding all the numbers either on standard input
or in a file.
\begin_deeper
\layout Standard
For example, to input from standard input you could simply type:
\layout Code
numsum
\layout Standard
To input from a file you would type:
\layout Code
numsum file_name
\layout SGML
\layout SGML
Note:
\layout SGML
\layout SGML
Please note that this tool is part of the num-utils package.
\layout SGML
\layout SGML
\end_deeper
\layout Description
numprocess
\emph on
numprocess
\emph default
is used to perform some kind of batch operation on everything in a file
or on standard input.
\begin_deeper
\layout Standard
Use '/' (forward-slashes) to enclose expressions.
\layout Standard
Any expression will be applied to every number in the file or on standard
inputs
\layout Standard
For example, to input from standard input you could simply type:
\layout Code
numsum
\layout Standard
To input from a file and multiply every number by 1024 you would type:
\layout Code
numsum /*1024/ file_name
\layout SGML
\layout SGML
Note:
\layout SGML
\layout SGML
Please note that this tool is part of the num-utils package.
\layout SGML
\layout SGML
\end_inset
\layout SGML
\layout SGML
num-utils homepage
\layout SGML
\layout SGML
The
\begin_inset Quotes eld
\end_inset
num-utils
\begin_inset Quotes erd
\end_inset
homepage,
\begin_inset LatexCommand \url[Num Utils,]{https://suso.suso.org/programs/num-utils/}
\end_inset
contains a variety of command line programs that could be useful when performin
g maths on your GNU/Linux machine.
\layout SGML
\layout SGML
\layout Description
\noindent
units
\begin_inset LatexCommand \index{units}
\end_inset
Convert
\begin_inset LatexCommand \index{Convert}
\end_inset
units of measurement
\begin_inset LatexCommand \index{measurement}
\end_inset
between different
\begin_inset LatexCommand \index{different}
\end_inset
scales.
\begin_inset LatexCommand \index{scales}
\end_inset
For example,
\begin_inset LatexCommand \index{example}
\end_inset
centimeters
\begin_inset LatexCommand \index{centimeters}
\end_inset
to inches,
\begin_inset LatexCommand \index{inches}
\end_inset
litres
\begin_inset LatexCommand \index{litres}
\end_inset
to gallons.
\begin_inset LatexCommand \index{gallons}
\end_inset
\begin_deeper
\layout Standard
\noindent
Simply run
\begin_inset LatexCommand \index{run}
\end_inset
the program,
\begin_inset LatexCommand \index{program}
\end_inset
I recommend
\begin_inset LatexCommand \index{recommend}
\end_inset
running
\begin_inset LatexCommand \index{running}
\end_inset
it as follows:
\begin_inset LatexCommand \index{follows}
\end_inset
\layout Code
units --verbose
\layout Standard
This will run
\begin_inset LatexCommand \index{run}
\end_inset
the program
\begin_inset LatexCommand \index{program}
\end_inset
and it will tell
\begin_inset LatexCommand \index{tell}
\end_inset
you exactly
\begin_inset LatexCommand \index{exactly}
\end_inset
what it is doing.
\layout Standard
Example: you enter
\begin_inset LatexCommand \index{enter}
\end_inset
\begin_inset Quotes eld
\end_inset
60 meters
\begin_inset LatexCommand \index{meters}
\end_inset
\begin_inset Quotes erd
\end_inset
then you want it worked out in
\begin_inset Quotes eld
\end_inset
kilometers
\begin_inset Quotes erd
\end_inset
.
The first line
\begin_inset LatexCommand \index{line}
\end_inset
will tell
\begin_inset LatexCommand \index{tell}
\end_inset
you what this evaluates
\begin_inset LatexCommand \index{evaluates}
\end_inset
to.
\layout Standard
If you wanted the conversion
\begin_inset LatexCommand \index{conversion}
\end_inset
rate for
\begin_inset Quotes eld
\end_inset
meters
\begin_inset Quotes erd
\end_inset
to
\begin_inset Quotes eld
\end_inset
kilometers
\begin_inset Quotes erd
\end_inset
read
\begin_inset LatexCommand \index{read}
\end_inset
the second line
\begin_inset LatexCommand \index{line}
\end_inset
of the output
\begin_inset LatexCommand \index{output}
\end_inset
(which will tell
\begin_inset LatexCommand \index{tell}
\end_inset
you meters/1000).
\layout Standard
Note: press
\begin_inset LatexCommand \index{press}
\end_inset
CTRL-D (end-of-file key) when you are finished
\begin_inset LatexCommand \index{finished}
\end_inset
using
\emph on
units
\emph default
.
\end_deeper
\layout Description
python
\begin_inset LatexCommand \index{python}
\end_inset
Python
\begin_inset LatexCommand \index{Python}
\end_inset
is a very powerful,
\begin_inset LatexCommand \index{powerful}
\end_inset
easy to learn,
\begin_inset LatexCommand \index{learn}
\end_inset
general
\begin_inset LatexCommand \index{general}
\end_inset
purpose, interpreted
\begin_inset LatexCommand \index{interpreted}
\end_inset
programming
\begin_inset LatexCommand \index{programming}
\end_inset
language.
.h
\begin_inset LatexCommand \index{.h}
\end_inset
and it makes a great
\begin_inset LatexCommand \index{great}
\end_inset
calculator! If you don't have a calculator
\begin_inset LatexCommand \index{calculator}
\end_inset
installed
\begin_inset LatexCommand \index{installed}
\end_inset
then simply type
\emph on
python
\emph default
, then hit
\begin_inset LatexCommand \index{hit}
\end_inset
[Enter].
\begin_deeper
\layout Standard
This will execute
\begin_inset LatexCommand \index{execute}
\end_inset
the Python
\begin_inset LatexCommand \index{Python}
\end_inset
interpreter in interactive
\begin_inset LatexCommand \index{interactive}
\end_inset
mode.
Type your sums
\begin_inset LatexCommand \index{sums}
\end_inset
just like you would use a calculator.
\begin_inset LatexCommand \index{calculator}
\end_inset
Note that if you want to work
\begin_inset LatexCommand \index{work}
\end_inset
out fractions
\begin_inset LatexCommand \index{fractions}
\end_inset
make sure you use a decimal
\begin_inset LatexCommand \index{decimal}
\end_inset
point and a zero
\begin_inset LatexCommand \index{zero}
\end_inset
to obtain the correct
\begin_inset LatexCommand \index{correct}
\end_inset
answer (otherwise it will use integer
\begin_inset LatexCommand \index{integer}
\end_inset
division).
\begin_inset Note
collapsed false
\layout Standard
should add some real calculators\SpecialChar \ldots{}
bc is a very advanced calc, but its seems
complicated to use\SpecialChar \ldots{}
closer to C programming.
I find python much easier.
\layout Standard
don't know how to use dc either.
\end_inset
\layout Standard
To start
\begin_inset LatexCommand \index{start}
\end_inset
python in interactive
\begin_inset LatexCommand \index{interactive}
\end_inset
mode, simply type:
\layout Code
python
\layout Standard
Once python
\begin_inset LatexCommand \index{python}
\end_inset
is started
\begin_inset LatexCommand \index{started}
\end_inset
you can use it to add
\begin_inset LatexCommand \index{add}
\end_inset
up sums
\begin_inset LatexCommand \index{sums}
\end_inset
or maybe do some python programming.
\begin_inset LatexCommand \index{programming}
\end_inset
\layout Standard
Use CTRL-D (end-of-file key) to exit
\begin_inset LatexCommand \index{exit}
\end_inset
the Python
\begin_inset LatexCommand \index{Python}
\end_inset
interpreter.
\end_deeper
\layout Description
numgrep
\begin_inset LatexCommand \index{numgrep}
\end_inset
A little bit
\begin_inset LatexCommand \index{bit}
\end_inset
like grep
\begin_inset LatexCommand \index{grep}
\end_inset
only this is designed
\begin_inset LatexCommand \index{designed}
\end_inset
for numbers
\begin_inset LatexCommand \index{numbers}
\end_inset
only.
\begin_deeper
\layout Standard
Use '/' (forward slashes) to contain each expression.
\begin_inset LatexCommand \index{expression}
\end_inset
\layout Standard
Use m to find
\begin_inset LatexCommand \index{find}
\end_inset
multiples of the number
\begin_inset LatexCommand \index{number}
\end_inset
n and use f to find
\begin_inset LatexCommand \index{find}
\end_inset
factors
\begin_inset LatexCommand \index{factors}
\end_inset
of the number
\begin_inset LatexCommand \index{number}
\end_inset
n.
\layout Standard
Use commas
\begin_inset LatexCommand \index{commas}
\end_inset
to seperate expressions
\begin_inset LatexCommand \index{expressions}
\end_inset
and ..
(two dots) to represent
\begin_inset LatexCommand \index{represent}
\end_inset
a range.
\begin_inset LatexCommand \index{range}
\end_inset
\layout Standard
For example,
\begin_inset LatexCommand \index{example}
\end_inset
to input
\begin_inset LatexCommand \index{input}
\end_inset
from standard
\begin_inset LatexCommand \index{standard}
\end_inset
input
\begin_inset LatexCommand \index{input}
\end_inset
\begin_inset LatexCommand \index{standard input}
\end_inset
you could simply type:
\layout Code
numgrep
\layout Standard
To input
\begin_inset LatexCommand \index{input}
\end_inset
from a file
\begin_inset LatexCommand \index{file}
\end_inset
and look
\begin_inset LatexCommand \index{look}
\end_inset
for numbers
\begin_inset LatexCommand \index{numbers}
\end_inset
between 1 and 1000 you could type:
\layout Code
numgrep /1..1000/ file_name
\layout SGML
\layout SGML
This tool comes from the num-utils package
\layout SGML
\layout SGML
Please note that this tool is part of the num-utils package.
\layout SGML
\layout SGML
\end_deeper
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
so outdated I think its useless now\SpecialChar \ldots{}
\layout Description
write (send) a message to the terminal of another user.
CTRL-D (end-of-file) ends the message.
You may need to use
\emph on
mesg y
\emph default
to turn write permission on.
\begin_deeper
\layout Standard
Command syntax:
\layout Code
write user_name
\layout Standard
This should write to the particular user, it appears to work only in console
mode (at least in Mandrake Linux 9.0).
\end_deeper
\layout Description
talk To interactively chat in real-time with another user.
Also try,
\emph on
ytalk
\emph default
, which allows you to connect to multiple users, and
\emph on
xchat
\emph default
.
\layout Description
scrapped the section because I don't know it well enough
\layout Description
wall Send a broadcast message to all users who have write permission turned
on (users will normally have write permission off\SpecialChar \ldots{}
use
\emph on
mesg
\emph default
to change this).
\layout Chapter
Communication (within the network)
\begin_inset LatexCommand \label{Communication}
\end_inset
\layout Description
mesg A very simple utility that turns write permission on or off (to send
messages).
\begin_deeper
\layout Standard
Simply type:
\layout Code
mesg y
\layout Standard
To turn write permission on, or
\layout Code
mesg n
\layout Standard
To turn write permission off
\end_deeper
\layout Standard
\begin_inset Note
collapsed true
\layout Standard
what other tools are there for in network communication?
\layout Standard
write user seems to work only is console mode, you can do writevt, or write
user \SpecialChar \ldots{}
\end_inset
\end_inset
\layout Chapter
Network Commands
\begin_inset LatexCommand \label{Network-commands}
\end_inset
\begin_inset Note
collapsed true
\layout Description
the author is not very familiar with networking commands\SpecialChar \ldots{}
\layout Standard
I'm sort of following what information I find online\SpecialChar \ldots{}
I don't currently know
much about this\SpecialChar \ldots{}
contributions are welcome (to somecsstudent@gmail.com)
\layout Standard
notes:
\layout Standard
nstat removed
\layout Description
usernetctl Sometimes users are granted the ability to bring certain interfaces
up or down on their own; this is the command they use.
It is like an emasculated version of
\emph on
ifconfig
\emph default
, that can only turn the interface on or off.
\begin_deeper
\layout Standard
\noindent
The syntax is normally:
\layout Code
\noindent
usernetctl device-name option
\end_deeper
\layout Code
\layout Standard
not sure if usernetctl is worth having\SpecialChar \ldots{}
how many ppl allow users to control
interfaces? although it would be useful for wireless networking.
\layout Standard
in wireless you have the iwconfig could be useful!
\end_inset
\layout Standard
The network
\begin_inset LatexCommand \index{network}
\end_inset
commands chapter explains
\begin_inset LatexCommand \index{explains}
\end_inset
various tools
\begin_inset LatexCommand \index{tools}
\end_inset
which can be useful when networking
\begin_inset LatexCommand \index{networking}
\end_inset
with other computers
\begin_inset LatexCommand \index{computers}
\end_inset
both within the network
\begin_inset LatexCommand \index{network}
\end_inset
and accross the internet,
\begin_inset LatexCommand \index{internet}
\end_inset
obtaining more
\begin_inset LatexCommand \index{more}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
about other computers.
\begin_inset LatexCommand \index{computers}
\end_inset
This chapter also includes
\begin_inset LatexCommand \index{includes}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on tools
\begin_inset LatexCommand \index{tools}
\end_inset
for network
\begin_inset LatexCommand \index{network}
\end_inset
configuration, file
\begin_inset LatexCommand \index{file}
\end_inset
transfer
\begin_inset LatexCommand \index{transfer}
\end_inset
and working
\begin_inset LatexCommand \index{working}
\end_inset
with remote
\begin_inset LatexCommand \index{remote}
\end_inset
machines.
\begin_inset LatexCommand \index{machines}
\end_inset
\layout Description
\noindent
netstat
\begin_inset LatexCommand \index{netstat}
\end_inset
Displays contents
\begin_inset LatexCommand \index{contents}
\end_inset
of /proc/net files.
\begin_inset LatexCommand \index{files}
\end_inset
It works
\begin_inset LatexCommand \index{works}
\end_inset
with the Linux
\begin_inset LatexCommand \index{Linux}
\end_inset
Network Subsystem,
\begin_inset LatexCommand \index{Subsystem}
\end_inset
it will tell
\begin_inset LatexCommand \index{tell}
\end_inset
you what the status
\begin_inset LatexCommand \index{status}
\end_inset
of ports
\begin_inset LatexCommand \index{ports}
\end_inset
are ie.
open,
\begin_inset LatexCommand \index{open}
\end_inset
closed,
\begin_inset LatexCommand \index{closed}
\end_inset
waiting,
\begin_inset LatexCommand \index{waiting}
\end_inset
masquerade
\begin_inset LatexCommand \index{masquerade}
\end_inset
connections.
It will also display
\begin_inset LatexCommand \index{display}
\end_inset
various other things.
It has many different
\begin_inset LatexCommand \index{different}
\end_inset
options.
\begin_inset LatexCommand \index{options}
\end_inset
\layout Description
\noindent
tcpdump
\begin_inset LatexCommand \index{tcpdump}
\end_inset
This is a sniffer,
\begin_inset LatexCommand \index{sniffer}
\end_inset
a program
\begin_inset LatexCommand \index{program}
\end_inset
that captures
\begin_inset LatexCommand \index{captures}
\end_inset
packets off
\begin_inset LatexCommand \index{off}
\end_inset
a network
\begin_inset LatexCommand \index{network}
\end_inset
interface
\begin_inset LatexCommand \index{interface}
\end_inset
and interprets
\begin_inset LatexCommand \index{interprets}
\end_inset
them for you.
It understands all basic
\begin_inset LatexCommand \index{basic}
\end_inset
Internet
\begin_inset LatexCommand \index{Internet}
\end_inset
protocols,
\begin_inset LatexCommand \index{protocols}
\end_inset
and can be used to save
\begin_inset LatexCommand \index{save}
\end_inset
entire
\begin_inset LatexCommand \index{entire}
\end_inset
packets
\begin_inset LatexCommand \index{packets}
\end_inset
for later inspection.
\begin_inset LatexCommand \index{inspection}
\end_inset
\layout Description
\noindent
ping The ping
\begin_inset LatexCommand \index{ping}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
(named after the sound
\begin_inset LatexCommand \index{sound}
\end_inset
of an active
\begin_inset LatexCommand \index{active}
\end_inset
sonar system) sends
\begin_inset LatexCommand \index{sends}
\end_inset
echo requests
\begin_inset LatexCommand \index{requests}
\end_inset
to the host
\begin_inset LatexCommand \index{host}
\end_inset
you specify
\begin_inset LatexCommand \index{specify}
\end_inset
on the command
\begin_inset LatexCommand \index{command}
\end_inset
line, and lists
\begin_inset LatexCommand \index{lists}
\end_inset
the responses
\begin_inset LatexCommand \index{responses}
\end_inset
received
\begin_inset LatexCommand \index{received}
\end_inset
their round
\begin_inset LatexCommand \index{round}
\end_inset
trip time.
\begin_inset LatexCommand \index{time}
\end_inset
\begin_deeper
\layout Standard
\noindent
You simply use ping
\begin_inset LatexCommand \index{ping}
\end_inset
as:
\layout Code
ping ip_or_host_name
\layout Standard
The host
\begin_inset LatexCommand \index{host}
\end_inset
name will work
\begin_inset LatexCommand \index{work}
\end_inset
if the IP
\begin_inset LatexCommand \index{IP}
\end_inset
address is listed
\begin_inset LatexCommand \index{listed}
\end_inset
in
\begin_inset Quotes eld
\end_inset
/etc/hosts
\begin_inset Quotes erd
\end_inset
(if it's within your network) or if your on the internet
\begin_inset LatexCommand \index{internet}
\end_inset
it will use the DNS
\begin_inset LatexCommand \index{DNS}
\end_inset
system.
Note to stop
\begin_inset LatexCommand \index{stop}
\end_inset
ping (otherwise it goes forever) use CTRL-C (break).
\end_deeper
\layout Description
\noindent
hostname
\begin_inset LatexCommand \index{hostname}
\end_inset
Tells the user
\begin_inset LatexCommand \index{user}
\end_inset
the host
\begin_inset LatexCommand \index{host}
\end_inset
name of the computer
\begin_inset LatexCommand \index{computer}
\end_inset
they are logged
\begin_inset LatexCommand \index{logged}
\end_inset
into.
Note: may be called
\emph on
host.
\layout Description
\noindent
traceroute
\begin_inset LatexCommand \index{traceroute}
\end_inset
\emph on
traceroute
\emph default
will show
\begin_inset LatexCommand \index{show}
\end_inset
the route
\begin_inset LatexCommand \index{route}
\end_inset
of a packet.
\begin_inset LatexCommand \index{packet}
\end_inset
It attempts
\begin_inset LatexCommand \index{attempts}
\end_inset
to list
\begin_inset LatexCommand \index{list}
\end_inset
the series
\begin_inset LatexCommand \index{series}
\end_inset
of hosts
\begin_inset LatexCommand \index{hosts}
\end_inset
through which
\begin_inset LatexCommand \index{which}
\end_inset
your packets
\begin_inset LatexCommand \index{packets}
\end_inset
travel
\begin_inset LatexCommand \index{travel}
\end_inset
on their way to a given destination.
\begin_inset LatexCommand \index{destination}
\end_inset
Also have a look
\begin_inset LatexCommand \index{look}
\end_inset
at
\emph on
xtraceroute
\emph default
(one of several
\begin_inset LatexCommand \index{several}
\end_inset
graphical
\begin_inset LatexCommand \index{graphical}
\end_inset
equivalents of this program).
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
traceroute machine_name_or_ip
\end_deeper
\layout Description
tracepath
\begin_inset LatexCommand \index{tracepath}
\end_inset
\emph on
tracepath
\emph default
performs
\begin_inset LatexCommand \index{performs}
\end_inset
a very simlar function
\begin_inset LatexCommand \index{function}
\end_inset
to
\emph on
traceroute
\emph default
the main difference
\begin_inset LatexCommand \index{difference}
\end_inset
is that
\emph on
tracepath
\emph default
doesn't take
\begin_inset LatexCommand \index{take}
\end_inset
complicated
\begin_inset LatexCommand \index{complicated}
\end_inset
options.
\begin_inset Note
collapsed true
\layout Standard
and can be executed by non-root users.--and I think that traceroute can be
too although their both in /usr/sbin
\end_inset
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
tracepath machine_name_or_ip
\end_deeper
\layout Description
findsmb
\begin_inset LatexCommand \index{findsmb}
\end_inset
\emph on
findsmb
\emph default
is used to list
\begin_inset LatexCommand \index{list}
\end_inset
info
\begin_inset LatexCommand \index{info}
\end_inset
about machines
\begin_inset LatexCommand \index{machines}
\end_inset
that respond
\begin_inset LatexCommand \index{respond}
\end_inset
to SMB
\begin_inset LatexCommand \index{SMB}
\end_inset
name queries
\begin_inset LatexCommand \index{queries}
\end_inset
(eg.
windows
\begin_inset LatexCommand \index{windows}
\end_inset
based machines
\begin_inset LatexCommand \index{machines}
\end_inset
sharing
\begin_inset LatexCommand \index{sharing}
\end_inset
their hard disk's).
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
findsmb
\layout Standard
This would find
\begin_inset LatexCommand \index{find}
\end_inset
all machines
\begin_inset LatexCommand \index{machines}
\end_inset
possible,
\begin_inset LatexCommand \index{possible}
\end_inset
you may need to specify
\begin_inset LatexCommand \index{specify}
\end_inset
a particular
\begin_inset LatexCommand \index{particular}
\end_inset
subnet to query those machines only\SpecialChar \ldots{}
\end_deeper
\layout Description
nmap
\begin_inset LatexCommand \index{nmap}
\end_inset
\begin_inset Quotes eld
\end_inset
network
\begin_inset LatexCommand \index{network}
\end_inset
exploration tool
\begin_inset LatexCommand \index{tool}
\end_inset
and security
\begin_inset LatexCommand \index{security}
\end_inset
scanner
\begin_inset LatexCommand \index{scanner}
\end_inset
\begin_inset Quotes erd
\end_inset
.
\emph on
nmap
\emph default
is a very advanced
\begin_inset LatexCommand \index{advanced}
\end_inset
network
\begin_inset LatexCommand \index{network}
\end_inset
tool
\begin_inset LatexCommand \index{tool}
\end_inset
used to query
\begin_inset LatexCommand \index{query}
\end_inset
machines (local or remote) as to whether they are up and what ports
\begin_inset LatexCommand \index{ports}
\end_inset
are open
\begin_inset LatexCommand \index{open}
\end_inset
on these machines.
\begin_inset LatexCommand \index{machines}
\end_inset
\begin_deeper
\layout Standard
A simple usage
\begin_inset LatexCommand \index{usage}
\end_inset
example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
nmap machine_name
\layout Standard
This would query
\begin_inset LatexCommand \index{query}
\end_inset
your own machine
\begin_inset LatexCommand \index{machine}
\end_inset
as to what ports
\begin_inset LatexCommand \index{ports}
\end_inset
it keeps open.
\begin_inset LatexCommand \index{open}
\end_inset
\emph on
nmap
\emph default
is a very powerful
\begin_inset LatexCommand \index{powerful}
\end_inset
tool,
\begin_inset LatexCommand \index{tool}
\end_inset
documentation
\begin_inset LatexCommand \index{documentation}
\end_inset
is available
\begin_inset LatexCommand \index{available}
\end_inset
on the
\begin_inset LatexCommand \url[nmap site]{https://www.insecure.org/nmap/}
\end_inset
as well as the information
\begin_inset LatexCommand \index{information}
\end_inset
in the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page.
\begin_inset LatexCommand \index{page}
\end_inset
\end_deeper
\layout Section
\noindent
Network Configuration
\begin_inset LatexCommand \label{network-configuration}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
ifport if some of your network cards are fancy and support multiple transceiver
types, then you start configuration by using this command to specify which
transceiver type you will use.
? useful?
\end_inset
\layout Description
\noindent
ifconfig
\begin_inset LatexCommand \index{ifconfig}
\end_inset
This command
\begin_inset LatexCommand \index{command}
\end_inset
is used to configure
\begin_inset LatexCommand \index{configure}
\end_inset
network
\begin_inset LatexCommand \index{network}
\end_inset
interfaces, or to display
\begin_inset LatexCommand \index{display}
\end_inset
their current
\begin_inset LatexCommand \index{current}
\end_inset
configuration.
\begin_inset LatexCommand \index{configuration}
\end_inset
In addition
\begin_inset LatexCommand \index{addition}
\end_inset
to activating
\begin_inset LatexCommand \index{activating}
\end_inset
and deactivating
\begin_inset LatexCommand \index{deactivating}
\end_inset
interfaces
\begin_inset LatexCommand \index{interfaces}
\end_inset
with the
\begin_inset Quotes eld
\end_inset
up
\begin_inset Quotes erd
\end_inset
and
\begin_inset Quotes eld
\end_inset
down
\begin_inset Quotes erd
\end_inset
settings,
\begin_inset LatexCommand \index{settings}
\end_inset
this command
\begin_inset LatexCommand \index{command}
\end_inset
is necessary for setting
\begin_inset LatexCommand \index{setting}
\end_inset
an interface's address
\begin_inset LatexCommand \index{address}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
if you don't have the
\emph on
ifcfg
\emph default
script.
\begin_inset LatexCommand \index{script}
\end_inset
\begin_deeper
\layout Standard
\noindent
Use
\emph on
ifconfig
\emph default
as either:
\layout Code
ifconfig
\layout Standard
This will simply list
\begin_inset LatexCommand \index{list}
\end_inset
all information
\begin_inset LatexCommand \index{information}
\end_inset
on all network
\begin_inset LatexCommand \index{network}
\end_inset
devices currently up.
\layout Code
ifconfig eth0 down
\layout Standard
This will take
\begin_inset LatexCommand \index{take}
\end_inset
eth0 (assuming the device
\begin_inset LatexCommand \index{device}
\end_inset
exists) down, it won't be able
\begin_inset LatexCommand \index{able}
\end_inset
to receive
\begin_inset LatexCommand \index{receive}
\end_inset
or send
\begin_inset LatexCommand \index{send}
\end_inset
anything until
\begin_inset LatexCommand \index{until}
\end_inset
you put it
\begin_inset Quotes eld
\end_inset
up
\begin_inset Quotes erd
\end_inset
again.
\layout Standard
Clearly there are a lot more
\begin_inset LatexCommand \index{more}
\end_inset
commands
\begin_inset LatexCommand \index{commands}
\end_inset
for this tool,
\begin_inset LatexCommand \index{tool}
\end_inset
you will need to read
\begin_inset LatexCommand \index{read}
\end_inset
the manual/info page
\begin_inset LatexCommand \index{page}
\end_inset
to learn
\begin_inset LatexCommand \index{learn}
\end_inset
more
\begin_inset LatexCommand \index{more}
\end_inset
about them.
\layout Standard
\begin_inset Note
collapsed true
\layout Standard
because I really don't know anything about them :)
\end_inset
\end_deeper
\layout Description
ifup
\begin_inset LatexCommand \index{ifup}
\end_inset
Use
\emph on
ifup
\begin_inset LatexCommand \index{ifup}
\end_inset
device-name
\emph default
to bring an interface
\begin_inset LatexCommand \index{interface}
\end_inset
up by following
\begin_inset LatexCommand \index{following}
\end_inset
a script
\begin_inset LatexCommand \index{script}
\end_inset
(which will contain your default
\begin_inset LatexCommand \index{default}
\end_inset
networking
\begin_inset LatexCommand \index{networking}
\end_inset
settings).
Simply type
\emph on
ifup
\begin_inset LatexCommand \index{ifup}
\end_inset
\emph default
and you will get help
\begin_inset LatexCommand \index{help}
\end_inset
on using the script.
\begin_inset LatexCommand \index{script}
\end_inset
\begin_deeper
\layout Standard
For example
\begin_inset LatexCommand \index{example}
\end_inset
typing:
\layout Code
ifup eth0
\layout Standard
Will bring eth0
\begin_inset LatexCommand \index{eth0}
\end_inset
up if it is currently down.
\end_deeper
\layout Description
ifdown
\begin_inset LatexCommand \index{ifdown}
\end_inset
Use
\emph on
ifdown
\begin_inset LatexCommand \index{ifdown}
\end_inset
device-name
\emph default
to bring an interface
\begin_inset LatexCommand \index{interface}
\end_inset
down using a script
\begin_inset LatexCommand \index{script}
\end_inset
(which will contain your default
\begin_inset LatexCommand \index{default}
\end_inset
network
\begin_inset LatexCommand \index{network}
\end_inset
settings).
Simply type
\emph on
ifdown
\begin_inset LatexCommand \index{ifdown}
\end_inset
\emph default
and you will get help
\begin_inset LatexCommand \index{help}
\end_inset
on using the script.
\begin_inset LatexCommand \index{script}
\end_inset
\begin_deeper
\layout Standard
For example
\begin_inset LatexCommand \index{example}
\end_inset
typing:
\layout Code
ifdown eth0
\layout Standard
Will bring eth0
\begin_inset LatexCommand \index{eth0}
\end_inset
down if it is currently up.
\end_deeper
\layout Description
ifcfg
\begin_inset LatexCommand \index{ifcfg}
\end_inset
Use
\emph on
ifcfg
\emph default
to configure
\begin_inset LatexCommand \index{configure}
\end_inset
a particular
\begin_inset LatexCommand \index{particular}
\end_inset
interface.
\begin_inset LatexCommand \index{interface}
\end_inset
Simply type ifcfg
\begin_inset LatexCommand \index{ifcfg}
\end_inset
to get help
\begin_inset LatexCommand \index{help}
\end_inset
on using this script.
\begin_inset LatexCommand \index{script}
\end_inset
\begin_deeper
\layout Standard
For example,
\begin_inset LatexCommand \index{example}
\end_inset
to change
\begin_inset LatexCommand \index{change}
\end_inset
eth0
\begin_inset LatexCommand \index{eth0}
\end_inset
from 192.168.0.1
\begin_inset LatexCommand \index{192.168.0.1}
\end_inset
to 192.168.0.2
\begin_inset LatexCommand \index{192.168.0.2}
\end_inset
you could do:
\layout Code
ifcfg eth0 del 192.168.0.1
\layout Code
ifcfg eth0 add 192.168.0.2
\layout Standard
The first command
\begin_inset LatexCommand \index{command}
\end_inset
takes eth0
\begin_inset LatexCommand \index{eth0}
\end_inset
down and removes
\begin_inset LatexCommand \index{removes}
\end_inset
that stored
\begin_inset LatexCommand \index{stored}
\end_inset
IP
\begin_inset LatexCommand \index{IP}
\end_inset
address and the second one brings it back up with the new
\begin_inset LatexCommand \index{new}
\end_inset
address.
\end_deeper
\layout Description
\noindent
route
\begin_inset LatexCommand \index{route}
\end_inset
The
\emph on
route
\emph default
command
\begin_inset LatexCommand \index{command}
\end_inset
is the tool
\begin_inset LatexCommand \index{tool}
\end_inset
used to display
\begin_inset LatexCommand \index{display}
\end_inset
or modify
\begin_inset LatexCommand \index{modify}
\end_inset
the routing
\begin_inset LatexCommand \index{routing}
\end_inset
table.
\begin_inset LatexCommand \index{table}
\end_inset
To add
\begin_inset LatexCommand \index{add}
\end_inset
a gateway
\begin_inset LatexCommand \index{gateway}
\end_inset
as the default
\begin_inset LatexCommand \index{default}
\end_inset
you would type:
\begin_deeper
\layout Code
route add default gw some_computer
\end_deeper
\layout Section
\noindent
Internet Specific Commands
\begin_inset LatexCommand \label{internet-specific-commands}
\end_inset
\layout Standard
Note that should DNS
\begin_inset LatexCommand \index{DNS}
\end_inset
not be configured correctly
\begin_inset LatexCommand \index{correctly}
\end_inset
on your machine,
\begin_inset LatexCommand \index{machine}
\end_inset
you need to edit
\begin_inset LatexCommand \index{edit}
\end_inset
\begin_inset Quotes eld
\end_inset
/etc/resolv.conf
\begin_inset Quotes erd
\end_inset
to make things work\SpecialChar \ldots{}
\layout Description
host
\begin_inset LatexCommand \index{host}
\end_inset
Performs a simple lookup
\begin_inset LatexCommand \index{lookup}
\end_inset
of an internet
\begin_inset LatexCommand \index{internet}
\end_inset
address (using the Domain
\begin_inset LatexCommand \index{Domain}
\end_inset
Name System,
\begin_inset LatexCommand \index{System}
\end_inset
DNS).
Simply type:
\begin_deeper
\layout Code
host ip_address
\layout Standard
or
\layout Code
host domain_name
\end_deeper
\layout Description
\noindent
dig
\begin_inset LatexCommand \index{dig}
\end_inset
The "domain information
\begin_inset LatexCommand \index{information}
\end_inset
groper" tool.
\begin_inset LatexCommand \index{tool}
\end_inset
More advanced
\begin_inset LatexCommand \index{advanced}
\end_inset
then
\emph on
host
\emph default
\SpecialChar \ldots{}
Give a host-name
\begin_inset LatexCommand \index{host-name}
\end_inset
as an argument
\begin_inset LatexCommand \index{argument}
\end_inset
to output
\begin_inset LatexCommand \index{output}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
about that host,
\begin_inset LatexCommand \index{host}
\end_inset
including
\begin_inset LatexCommand \index{including}
\end_inset
it's IP
\begin_inset LatexCommand \index{IP}
\end_inset
address, hostname
\begin_inset LatexCommand \index{hostname}
\end_inset
and various other information.
\begin_inset LatexCommand \index{information}
\end_inset
\begin_deeper
\layout Standard
\noindent
For example,
\begin_inset LatexCommand \index{example}
\end_inset
to look
\begin_inset LatexCommand \index{look}
\end_inset
up information
\begin_inset LatexCommand \index{information}
\end_inset
about
\begin_inset Quotes eld
\end_inset
www.amazon.com
\begin_inset Quotes erd
\end_inset
type:
\layout Code
\noindent
dig www.amazon.com
\layout Standard
\noindent
To find
\begin_inset LatexCommand \index{find}
\end_inset
the host
\begin_inset LatexCommand \index{host}
\end_inset
name for a given IP
\begin_inset LatexCommand \index{IP}
\end_inset
address (ie a reverse
\begin_inset LatexCommand \index{reverse}
\end_inset
lookup), use
\emph on
dig
\emph default
with the
\emph on
`-x'
\emph default
option.
\begin_inset LatexCommand \index{option}
\end_inset
\layout Code
\noindent
dig -x 100.42.30.95
\layout Standard
\noindent
This will look
\begin_inset LatexCommand \index{look}
\end_inset
up the address
\begin_inset LatexCommand \index{address}
\end_inset
(which may or may not exist) and returns
\begin_inset LatexCommand \index{returns}
\end_inset
the address
\begin_inset LatexCommand \index{address}
\end_inset
of the host,
\begin_inset LatexCommand \index{host}
\end_inset
for example
\begin_inset LatexCommand \index{example}
\end_inset
if that was the address
\begin_inset LatexCommand \index{address}
\end_inset
of https:
\begin_inset LatexCommand \index{http}
\end_inset
//slashdot.org then it would return
\begin_inset LatexCommand \index{return}
\end_inset
\begin_inset Quotes eld
\end_inset
https://slashdot.org
\begin_inset Quotes erd
\end_inset
.
\layout Standard
\noindent
\emph on
dig
\emph default
takes
\begin_inset LatexCommand \index{takes}
\end_inset
a huge
\begin_inset LatexCommand \index{huge}
\end_inset
number
\begin_inset LatexCommand \index{number}
\end_inset
of options
\begin_inset LatexCommand \index{options}
\end_inset
(at the point of being too many), refer
\begin_inset LatexCommand \index{refer}
\end_inset
to the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
for more
\begin_inset LatexCommand \index{more}
\end_inset
information.
\begin_inset LatexCommand \index{information}
\end_inset
\layout Standard
\noindent
\begin_inset Note
collapsed false
\layout Standard
this command replaces nslookup\SpecialChar \ldots{}
nslookup is now redundant\SpecialChar \ldots{}
\end_inset
\end_deeper
\layout Description
\noindent
whois
\begin_inset LatexCommand \index{whois}
\end_inset
(now BW whois) is used to look
\begin_inset LatexCommand \index{look}
\end_inset
up the contact
\begin_inset LatexCommand \index{contact}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
from the
\begin_inset Quotes eld
\end_inset
whois
\begin_inset Quotes erd
\end_inset
databases,
\begin_inset LatexCommand \index{databases}
\end_inset
the servers
\begin_inset LatexCommand \index{servers}
\end_inset
are only likely to hold major
\begin_inset LatexCommand \index{major}
\end_inset
sites.
Note that contact
\begin_inset LatexCommand \index{contact}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
is likely to be hidden
\begin_inset LatexCommand \index{hidden}
\end_inset
or restricted
\begin_inset LatexCommand \index{restricted}
\end_inset
as it is often abused
\begin_inset LatexCommand \index{abused}
\end_inset
by crackers
\begin_inset LatexCommand \index{crackers}
\end_inset
and others looking
\begin_inset LatexCommand \index{looking}
\end_inset
for a way to cause
\begin_inset LatexCommand \index{cause}
\end_inset
malicious damage
\begin_inset LatexCommand \index{damage}
\end_inset
to organisation's.
\layout Description
\noindent
wget
\begin_inset LatexCommand \index{wget}
\end_inset
(GNU Web
\begin_inset LatexCommand \index{Web}
\end_inset
get) used to download
\begin_inset LatexCommand \index{download}
\end_inset
files from the World
\begin_inset LatexCommand \index{World}
\end_inset
Wide Web.
\begin_deeper
\layout Standard
\noindent
To archive
\begin_inset LatexCommand \index{archive}
\end_inset
a single web
\begin_inset LatexCommand \index{web}
\end_inset
site, use the
\emph on
-m
\emph default
or
\emph on
--mirror
\emph default
(mirror) option.
\begin_inset LatexCommand \index{option}
\end_inset
\layout Standard
\noindent
Use
\emph on
\emph default
the
\emph on
-nc
\begin_inset LatexCommand \index{-nc}
\end_inset
\emph default
(no clobber) option
\begin_inset LatexCommand \index{option}
\end_inset
to stop
\begin_inset LatexCommand \index{stop}
\end_inset
\emph on
wget
\emph default
from overwriting
\begin_inset LatexCommand \index{overwriting}
\end_inset
a file
\begin_inset LatexCommand \index{file}
\end_inset
if you already have it.
\layout Standard
\noindent
Use the
\emph on
-c
\emph default
or
\emph on
--continue
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to continue a file
\begin_inset LatexCommand \index{file}
\end_inset
that was unfinished
\begin_inset LatexCommand \index{unfinished}
\end_inset
by wget
\begin_inset LatexCommand \index{wget}
\end_inset
or another program.
\begin_inset LatexCommand \index{program}
\end_inset
\layout Standard
\noindent
Simple usage
\begin_inset LatexCommand \index{usage}
\end_inset
example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
wget url_for_file
\layout Standard
This would simply get a file
\begin_inset LatexCommand \index{file}
\end_inset
from a site.
\begin_inset LatexCommand \index{site}
\end_inset
\layout Standard
\emph on
wget
\emph default
can also retrieve
\begin_inset LatexCommand \index{retrieve}
\end_inset
multiple files
\begin_inset LatexCommand \index{files}
\end_inset
using standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards,
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
the same as the type used in bash,
\begin_inset LatexCommand \index{bash}
\end_inset
like *, [ ], ?.
Simply use
\emph on
wget
\emph default
as per normal
\begin_inset LatexCommand \index{normal}
\end_inset
but use single quotation
\begin_inset LatexCommand \index{quotation}
\end_inset
marks (' ') on the URL
\begin_inset LatexCommand \index{URL}
\end_inset
to prevent
\begin_inset LatexCommand \index{prevent}
\end_inset
bash
\begin_inset LatexCommand \index{bash}
\end_inset
from expanding
\begin_inset LatexCommand \index{expanding}
\end_inset
the wildcards.
\begin_inset LatexCommand \index{wildcards}
\end_inset
There are complications if you are retrieving from a http site (see below\SpecialChar \ldots{}
).
\layout Standard
Advanced usage
\begin_inset LatexCommand \index{usage}
\end_inset
example,
\begin_inset LatexCommand \index{example}
\end_inset
(used from
\emph on
wget
\emph default
manual
\begin_inset LatexCommand \index{manual}
\end_inset
page):
\begin_inset Note
collapsed false
\layout Standard
reference this correctly? from manual page.
\end_inset
\layout Code
wget --spider --force-html -i bookmarks.html
\layout Standard
This will parse
\begin_inset LatexCommand \index{parse}
\end_inset
the file
\begin_inset LatexCommand \index{file}
\end_inset
bookmarks.html
\begin_inset LatexCommand \index{bookmarks.html}
\end_inset
and check
\begin_inset LatexCommand \index{check}
\end_inset
that all the links
\begin_inset LatexCommand \index{links}
\end_inset
exist.
\begin_inset LatexCommand \index{exist}
\end_inset
\layout Standard
Advanced usage;
\begin_inset LatexCommand \index{usage}
\end_inset
this is how you can download
\begin_inset LatexCommand \index{download}
\end_inset
multiple files
\begin_inset LatexCommand \index{files}
\end_inset
using http
\begin_inset LatexCommand \index{http}
\end_inset
(using a wildcard\SpecialChar \ldots{}
).
\layout Standard
Notes: http
\begin_inset LatexCommand \index{http}
\end_inset
doesn't support
\begin_inset LatexCommand \index{support}
\end_inset
downloading
\begin_inset LatexCommand \index{downloading}
\end_inset
using standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards,
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
ftp
\begin_inset LatexCommand \index{ftp}
\end_inset
does so you may use wildcards
\begin_inset LatexCommand \index{wildcards}
\end_inset
with ftp
\begin_inset LatexCommand \index{ftp}
\end_inset
and it will work
\begin_inset LatexCommand \index{work}
\end_inset
fine.
A work-around
\begin_inset LatexCommand \index{work-around}
\end_inset
for this http
\begin_inset LatexCommand \index{http}
\end_inset
limitation is shown
\begin_inset LatexCommand \index{shown}
\end_inset
below:
\layout Code
wget -r -l1 --no-parent -A.gif https://www.website.com
\begin_inset Foot
collapsed false
\layout Standard
This way around the wildcard limitation has been adopted (with a tiny amount
of editing) from
\begin_inset LatexCommand \url[wget manual page]{https://www.lns.cornell.edu/public/COMP/info/wget/wget_7.html}
\end_inset
, see [9] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
\layout Standard
This will download
\begin_inset LatexCommand \index{download}
\end_inset
(recursively), to a depth
\begin_inset LatexCommand \index{depth}
\end_inset
of one, in other words
\begin_inset LatexCommand \index{words}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
and not below that.
This command
\begin_inset LatexCommand \index{command}
\end_inset
will ignore
\begin_inset LatexCommand \index{ignore}
\end_inset
references
\begin_inset LatexCommand \index{references}
\end_inset
to the parent
\begin_inset LatexCommand \index{parent}
\end_inset
directory,
\begin_inset LatexCommand \index{directory}
\end_inset
and downloads
\begin_inset LatexCommand \index{downloads}
\end_inset
anything that ends
\begin_inset LatexCommand \index{ends}
\end_inset
in
\begin_inset Quotes eld
\end_inset
.gif
\begin_inset Quotes erd
\end_inset
.
If you wanted to download
\begin_inset LatexCommand \index{download}
\end_inset
say, anything that ends
\begin_inset LatexCommand \index{ends}
\end_inset
with
\begin_inset Quotes eld
\end_inset
.pdf
\begin_inset Quotes erd
\end_inset
as well than add
\begin_inset LatexCommand \index{add}
\end_inset
a
\emph on
-A.pdf
\emph default
before the website
\begin_inset LatexCommand \index{website}
\end_inset
address.
Simply change
\begin_inset LatexCommand \index{change}
\end_inset
the website
\begin_inset LatexCommand \index{website}
\end_inset
address and the type of file
\begin_inset LatexCommand \index{file}
\end_inset
being downloaded
\begin_inset LatexCommand \index{downloaded}
\end_inset
to download
\begin_inset LatexCommand \index{download}
\end_inset
something else.
Note that doing
\emph on
-A.gif
\emph default
is the same as doing
\emph on
-A
\begin_inset Quotes eld
\end_inset
*.gif
\emph default
\begin_inset Quotes erd
\end_inset
(double quotes
\begin_inset LatexCommand \index{quotes}
\end_inset
only, single quotes
\begin_inset LatexCommand \index{quotes}
\end_inset
will not work).
\layout Standard
\emph on
wget
\emph default
has many more
\begin_inset LatexCommand \index{more}
\end_inset
options
\begin_inset LatexCommand \index{options}
\end_inset
refer to the examples
\begin_inset LatexCommand \index{examples}
\end_inset
section of the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page,
\begin_inset LatexCommand \index{page}
\end_inset
this tool
\begin_inset LatexCommand \index{tool}
\end_inset
is very well documented.
\layout SGML
\layout SGML
Alternative website downloaders
\layout SGML
You may like to try alternatives like httrack.
A full GUI website downloader written in python and available for GNU/Linux
\layout SGML
\end_deeper
\layout Description
curl
\begin_inset LatexCommand \index{curl}
\end_inset
\emph on
curl
\emph default
is another remote
\begin_inset LatexCommand \index{remote}
\end_inset
downloader.
\begin_inset LatexCommand \index{downloader}
\end_inset
This remote
\begin_inset LatexCommand \index{remote}
\end_inset
downloader
\begin_inset LatexCommand \index{downloader}
\end_inset
is designed
\begin_inset LatexCommand \index{designed}
\end_inset
to work
\begin_inset LatexCommand \index{work}
\end_inset
without user
\begin_inset LatexCommand \index{user}
\end_inset
interaction and supports
\begin_inset LatexCommand \index{supports}
\end_inset
a variety
\begin_inset LatexCommand \index{variety}
\end_inset
of protocols,
\begin_inset LatexCommand \index{protocols}
\end_inset
can upload/download and has a large number
\begin_inset LatexCommand \index{number}
\end_inset
of tricks/work-arounds for various things.
It can access
\begin_inset LatexCommand \index{access}
\end_inset
dictionary
\begin_inset LatexCommand \index{dictionary}
\end_inset
servers
\begin_inset LatexCommand \index{servers}
\end_inset
(dict), ldap
\begin_inset LatexCommand \index{ldap}
\end_inset
servers, ftp,
\begin_inset LatexCommand \index{ftp}
\end_inset
http,
\begin_inset LatexCommand \index{http}
\end_inset
gopher,
\begin_inset LatexCommand \index{gopher}
\end_inset
see the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
for full
\begin_inset LatexCommand \index{full}
\end_inset
details.
\begin_inset LatexCommand \index{details}
\end_inset
\begin_deeper
\layout Standard
To access
\begin_inset LatexCommand \index{access}
\end_inset
the full
\begin_inset LatexCommand \index{full}
\end_inset
manual
\begin_inset LatexCommand \index{manual}
\end_inset
(which is huge) for this command
\begin_inset LatexCommand \index{command}
\end_inset
type:
\layout Code
curl -M
\layout Standard
For general
\begin_inset LatexCommand \index{general}
\end_inset
usage you can use it like
\emph on
wget
\emph default
.
You can also login
\begin_inset LatexCommand \index{login}
\end_inset
using a user
\begin_inset LatexCommand \index{user}
\end_inset
name by using the
\emph on
-u
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
and typing your username
\begin_inset LatexCommand \index{username}
\end_inset
and password
\begin_inset LatexCommand \index{password}
\end_inset
like this:
\layout Code
curl -u username:password https://www.placetodownload/file
\layout Standard
To upload
\begin_inset LatexCommand \index{upload}
\end_inset
using ftp
\begin_inset LatexCommand \index{ftp}
\end_inset
you the
\emph on
-T
\emph default
option:
\begin_inset LatexCommand \index{option}
\end_inset
\layout Code
curl -T file_name ftp://ftp.uploadsite.com
\layout Standard
To continue a file
\begin_inset LatexCommand \index{file}
\end_inset
use the
\emph on
-C
\emph default
option:
\begin_inset LatexCommand \index{option}
\end_inset
\layout Code
curl -C - -o file https://www.site.com
\end_deeper
\layout Section
Remote Administration Related
\begin_inset LatexCommand \label{remote-administration}
\end_inset
\layout Description
ssh
\begin_inset LatexCommand \index{ssh}
\end_inset
Secure
\begin_inset LatexCommand \index{Secure}
\end_inset
shell,
\begin_inset LatexCommand \index{shell}
\end_inset
remotely
\begin_inset LatexCommand \index{remotely}
\end_inset
login
\begin_inset LatexCommand \index{login}
\end_inset
on a machine
\begin_inset LatexCommand \index{machine}
\end_inset
running
\begin_inset LatexCommand \index{running}
\end_inset
the
\emph on
sshd
\emph default
daemon.
\begin_inset LatexCommand \index{daemon}
\end_inset
Once you are logged
\begin_inset LatexCommand \index{logged}
\end_inset
in you have a secure
\begin_inset LatexCommand \index{secure}
\end_inset
shell
\begin_inset LatexCommand \index{shell}
\end_inset
and are able
\begin_inset LatexCommand \index{able}
\end_inset
to execute
\begin_inset LatexCommand \index{execute}
\end_inset
various commands
\begin_inset LatexCommand \index{commands}
\end_inset
on that computer
\begin_inset LatexCommand \index{computer}
\end_inset
such as copy
\begin_inset LatexCommand \index{copy}
\end_inset
files, shut
\begin_inset LatexCommand \index{shut}
\end_inset
it down, just like it was your own GNU/Linux PC.
\begin_inset LatexCommand \index{PC}
\end_inset
\begin_deeper
\layout Standard
Or you can use
\emph on
ssh
\emph default
with a full
\begin_inset LatexCommand \index{full}
\end_inset
hostname
\begin_inset LatexCommand \index{hostname}
\end_inset
to connect
\begin_inset LatexCommand \index{connect}
\end_inset
to a remote
\begin_inset LatexCommand \index{remote}
\end_inset
machine
\begin_inset LatexCommand \index{machine}
\end_inset
(as in across the internet).
\layout Standard
Examples:
\layout Code
ssh hostname
\layout Standard
Connect
\begin_inset LatexCommand \index{Connect}
\end_inset
to a remote
\begin_inset LatexCommand \index{remote}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
with your current
\begin_inset LatexCommand \index{current}
\end_inset
user
\begin_inset LatexCommand \index{user}
\end_inset
name, you will obviously need the password
\begin_inset LatexCommand \index{password}
\end_inset
of the user
\begin_inset LatexCommand \index{user}
\end_inset
on the other machine.
\begin_inset LatexCommand \index{machine}
\end_inset
\layout Code
ssh username@hostname
\layout Standard
Connect
\begin_inset LatexCommand \index{Connect}
\end_inset
to a remote
\begin_inset LatexCommand \index{remote}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
with your a different
\begin_inset LatexCommand \index{different}
\end_inset
user
\begin_inset LatexCommand \index{user}
\end_inset
name, you will obviously need the password
\begin_inset LatexCommand \index{password}
\end_inset
of the user
\begin_inset LatexCommand \index{user}
\end_inset
on the other machine.
\begin_inset LatexCommand \index{machine}
\end_inset
\end_deeper
\layout Description
scp
\begin_inset LatexCommand \index{scp}
\end_inset
Secure
\begin_inset LatexCommand \index{Secure}
\end_inset
copy,
\begin_inset LatexCommand \index{copy}
\end_inset
part
\begin_inset LatexCommand \index{part}
\end_inset
of the ssh
\begin_inset LatexCommand \index{ssh}
\end_inset
package.
\begin_inset LatexCommand \index{package}
\end_inset
Allows
\begin_inset LatexCommand \index{Allows}
\end_inset
you to copy
\begin_inset LatexCommand \index{copy}
\end_inset
files from one computer
\begin_inset LatexCommand \index{computer}
\end_inset
to another computer, use
\emph on
-r
\begin_inset LatexCommand \index{-r}
\end_inset
\emph default
to copy
\begin_inset LatexCommand \index{copy}
\end_inset
recursively (copy entire
\begin_inset LatexCommand \index{entire}
\end_inset
directories
\begin_inset LatexCommand \index{directories}
\end_inset
and subdirectories).
\begin_deeper
\layout Standard
\emph on
scp
\emph default
's syntax
\begin_inset LatexCommand \index{syntax}
\end_inset
is always
\layout Code
scp machineToBeCopiedFrom machineToBeCopiedTo
\layout Standard
Where either machine
\begin_inset LatexCommand \index{machine}
\end_inset
can be a local
\begin_inset LatexCommand \index{local}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
(on the current
\begin_inset LatexCommand \index{current}
\end_inset
filesystem
\begin_inset LatexCommand \index{filesystem}
\end_inset
/) or a remote
\begin_inset LatexCommand \index{remote}
\end_inset
machine.
\begin_inset LatexCommand \index{machine}
\end_inset
Remote
\begin_inset LatexCommand \index{Remote}
\end_inset
machines
\begin_inset LatexCommand \index{machines}
\end_inset
are usually
\emph on
machinesFullName:/directory
\emph default
(if you omit
\begin_inset LatexCommand \index{omit}
\end_inset
the directory
\begin_inset LatexCommand \index{directory}
\end_inset
part it will just assume the home
\begin_inset LatexCommand \index{home}
\end_inset
directory of the username
\begin_inset LatexCommand \index{username}
\end_inset
you are logging
\begin_inset LatexCommand \index{logging}
\end_inset
in with).
\layout Standard
The example
\begin_inset LatexCommand \index{example}
\end_inset
below copies
\begin_inset LatexCommand \index{copies}
\end_inset
all files
\begin_inset LatexCommand \index{files}
\end_inset
from the current
\begin_inset LatexCommand \index{current}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
(not including
\begin_inset LatexCommand \index{including}
\end_inset
any directories), the command
\begin_inset LatexCommand \index{command}
\end_inset
will login
\begin_inset LatexCommand \index{login}
\end_inset
to
\begin_inset Quotes eld
\end_inset
new
\begin_inset Quotes erd
\end_inset
using the username
\begin_inset LatexCommand \index{username}
\end_inset
of the person
\begin_inset LatexCommand \index{person}
\end_inset
currently logged
\begin_inset LatexCommand \index{logged}
\end_inset
in on the local
\begin_inset LatexCommand \index{local}
\end_inset
computer,
\begin_inset LatexCommand \index{computer}
\end_inset
the files
\begin_inset LatexCommand \index{files}
\end_inset
will be copied to the root
\begin_inset LatexCommand \index{root}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
of the remote
\begin_inset LatexCommand \index{remote}
\end_inset
computer
\begin_inset LatexCommand \index{computer}
\end_inset
called
\begin_inset Quotes eld
\end_inset
new
\begin_inset Quotes erd
\end_inset
(which is probably
\begin_inset LatexCommand \index{probably}
\end_inset
on the LAN):
\layout Code
scp * @new:/
\layout Standard
You could also copy
\begin_inset LatexCommand \index{copy}
\end_inset
files from another computer
\begin_inset LatexCommand \index{computer}
\end_inset
to another computer.
Let's say you are on a computer
\begin_inset LatexCommand \index{computer}
\end_inset
called
\begin_inset Quotes eld
\end_inset
p100
\begin_inset Quotes erd
\end_inset
.
And you want to copy
\begin_inset LatexCommand \index{copy}
\end_inset
files (and directories) from
\begin_inset Quotes eld
\end_inset
hp166
\begin_inset Quotes erd
\end_inset
(in the /tmp directory
\begin_inset LatexCommand \index{directory}
\end_inset
and anything below that) to
\begin_inset Quotes eld
\end_inset
new
\begin_inset Quotes erd
\end_inset
and put the files
\begin_inset LatexCommand \index{files}
\end_inset
in new's tempory
\begin_inset LatexCommand \index{tempory}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
You could do:
\layout Code
scp -r hp166:/tmp new:/tmp
\layout Standard
Assuming you were logged
\begin_inset LatexCommand \index{logged}
\end_inset
in as
\begin_inset Quotes eld
\end_inset
fred
\begin_inset Quotes erd
\end_inset
you would need passwords
\begin_inset LatexCommand \index{passwords}
\end_inset
for user
\begin_inset LatexCommand \index{user}
\end_inset
\begin_inset Quotes eld
\end_inset
fred
\begin_inset Quotes erd
\end_inset
on the computers
\begin_inset LatexCommand \index{computers}
\end_inset
hp166 and new.
\begin_inset LatexCommand \index{new}
\end_inset
Add
\begin_inset LatexCommand \index{Add}
\end_inset
an
\emph on
user_name@
\emph default
before the computer
\begin_inset LatexCommand \index{computer}
\end_inset
name to login
\begin_inset LatexCommand \index{login}
\end_inset
under a different
\begin_inset LatexCommand \index{different}
\end_inset
user
\begin_inset LatexCommand \index{user}
\end_inset
name.
\layout Standard
For example
\begin_inset LatexCommand \index{example}
\end_inset
to perform
\begin_inset LatexCommand \index{perform}
\end_inset
the above command
\begin_inset LatexCommand \index{command}
\end_inset
with user
\begin_inset LatexCommand \index{user}
\end_inset
\begin_inset Quotes eld
\end_inset
root
\begin_inset Quotes erd
\end_inset
on hp166
\begin_inset LatexCommand \index{hp166}
\end_inset
and
\begin_inset Quotes eld
\end_inset
anon
\begin_inset Quotes erd
\end_inset
on new
\begin_inset LatexCommand \index{new}
\end_inset
you would type:
\layout Code
scp -r root@hp166:/tmp anon@new:/tmp
\layout Standard
To copy
\begin_inset LatexCommand \index{copy}
\end_inset
from a remote
\begin_inset LatexCommand \index{remote}
\end_inset
machine
\begin_inset LatexCommand \index{machine}
\end_inset
to a local
\begin_inset LatexCommand \index{local}
\end_inset
computer
\begin_inset LatexCommand \index{computer}
\end_inset
you simply do things in reverse:
\begin_inset LatexCommand \index{reverse}
\end_inset
\layout Code
scp remoteMachine:/mystuff/* .
\layout Standard
This will copy
\begin_inset LatexCommand \index{copy}
\end_inset
files on the remote
\begin_inset LatexCommand \index{remote}
\end_inset
machine
\begin_inset LatexCommand \index{machine}
\end_inset
in the directory
\begin_inset LatexCommand \index{directory}
\end_inset
\begin_inset Quotes eld
\end_inset
mystuff
\begin_inset Quotes erd
\end_inset
to your local
\begin_inset LatexCommand \index{local}
\end_inset
computer.
\begin_inset LatexCommand \index{computer}
\end_inset
\layout SGML
\layout SGML
Remote Machines
\layout SGML
Please note that when working with a remote machine you need to have
a : (colon) after the machine name even if you want the files in their
home directory.
Otherwise the command will fail.
\layout SGML
\layout Standard
\begin_inset Note
collapsed true
\layout Standard
I really only know the s* commands from open-ssh, does anyone have other
suggestions? (sftp added) rync added.
\layout Standard
scp under this section or backup section? if its moved then its not with
the other s* commands.
\end_inset
\end_deeper
\layout Description
sftp
\begin_inset LatexCommand \index{sftp}
\end_inset
Secure ftp,
\begin_inset LatexCommand \index{ftp}
\end_inset
another part
\begin_inset LatexCommand \index{part}
\end_inset
of the ssh
\begin_inset LatexCommand \index{ssh}
\end_inset
package.
\begin_inset LatexCommand \index{package}
\end_inset
This command
\begin_inset LatexCommand \index{command}
\end_inset
is similar
\begin_inset LatexCommand \index{similar}
\end_inset
to ftp
\begin_inset LatexCommand \index{ftp}
\end_inset
but uses an encrypted
\begin_inset LatexCommand \index{encrypted}
\end_inset
tunnel
\begin_inset LatexCommand \index{tunnel}
\end_inset
to connect
\begin_inset LatexCommand \index{connect}
\end_inset
to an ftp
\begin_inset LatexCommand \index{ftp}
\end_inset
server
\begin_inset LatexCommand \index{server}
\end_inset
and is therefore more
\begin_inset LatexCommand \index{more}
\end_inset
secure
\begin_inset LatexCommand \index{secure}
\end_inset
than just plain
\begin_inset LatexCommand \index{plain}
\end_inset
\emph on
ftp
\emph default
.
\begin_deeper
\layout Standard
The command
\begin_inset LatexCommand \index{command}
\end_inset
usage is very similar
\begin_inset LatexCommand \index{similar}
\end_inset
to
\emph on
ftp
\emph default
(the command-line
\begin_inset LatexCommand \index{command-line}
\end_inset
tool),
\emph on
sftp
\emph default
(once running) uses commands
\begin_inset LatexCommand \index{commands}
\end_inset
such as
\emph on
help
\begin_inset LatexCommand \index{help}
\end_inset
\emph default
(for help),
\emph on
put
\emph default
(send files
\begin_inset LatexCommand \index{files}
\end_inset
to the server),
\emph on
get
\emph default
(download files
\begin_inset LatexCommand \index{files}
\end_inset
from the server) and various others, refer
\begin_inset LatexCommand \index{refer}
\end_inset
to the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
and internal
\begin_inset LatexCommand \index{internal}
\end_inset
documentation
\begin_inset LatexCommand \index{documentation}
\end_inset
for further details.
\begin_inset LatexCommand \index{details}
\end_inset
\end_deeper
\layout SGML
\layout SGML
Graphical programs
\layout SGML
Sometimes its easier to manage files with a GUI, many of these programs
do have good GUI equivalents, try searching the internet or sites like
\begin_inset LatexCommand \url[Sourceforge]{https://sourceforge.net}
\end_inset
or
\begin_inset LatexCommand \url[Freshmeat.]{https://freshmeat.net}
\end_inset
\layout SGML
\layout Chapter
Security
\begin_inset LatexCommand \label{Security}
\end_inset
\layout Standard
The security
\begin_inset LatexCommand \index{security}
\end_inset
chapter is designed
\begin_inset LatexCommand \index{designed}
\end_inset
to give the user
\begin_inset LatexCommand \index{user}
\end_inset
a very basic
\begin_inset LatexCommand \index{basic}
\end_inset
level
\begin_inset LatexCommand \index{level}
\end_inset
of understanding of security
\begin_inset LatexCommand \index{security}
\end_inset
within the GNU/Linux operating
\begin_inset LatexCommand \index{operating}
\end_inset
system.
\begin_inset LatexCommand \index{system}
\end_inset
This chapter also has information
\begin_inset LatexCommand \index{information}
\end_inset
on the UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
style file
\begin_inset LatexCommand \index{file}
\end_inset
permissions
\begin_inset LatexCommand \index{permissions}
\end_inset
used on most GNU/Linux machines.
\begin_inset LatexCommand \index{machines}
\end_inset
\layout Standard
More comprehensive
\begin_inset LatexCommand \index{comprehensive}
\end_inset
guides can be found
\begin_inset LatexCommand \index{found}
\end_inset
at the
\begin_inset LatexCommand \url[Linux Documentation Project]{https://www.tldp.org}
\end_inset
, such as the
\begin_inset LatexCommand \url[Linux Security howto]{https://www.tldp.org/HOWTO/Security-HOWTO/}
\end_inset
authored
\begin_inset LatexCommand \index{authored}
\end_inset
by Kevin Fenzi
\begin_inset LatexCommand \index{Kevin Fenzi}
\end_inset
and Dave Wreski.
\begin_inset LatexCommand \index{Dave Wreski}
\end_inset
\layout Standard
\added_space_bottom medskip
\begin_inset LatexCommand \index{medskip}
\end_inset
There are also sites
\begin_inset LatexCommand \index{sites}
\end_inset
such as
\begin_inset LatexCommand \url[Linux Security]{https://www.linuxsecurity.com}
\end_inset
.
If your looking
\begin_inset LatexCommand \index{looking}
\end_inset
for a program
\begin_inset LatexCommand \index{program}
\end_inset
to assist
\begin_inset LatexCommand \index{assist}
\end_inset
in locking
\begin_inset LatexCommand \index{locking}
\end_inset
down your operating
\begin_inset LatexCommand \index{operating}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
you may want to check
\begin_inset LatexCommand \index{check}
\end_inset
\begin_inset LatexCommand \url[Bastille Linux]{https://www.bastille-linux.org}
\end_inset
that runs
\begin_inset LatexCommand \index{runs}
\end_inset
on RPM
\begin_inset LatexCommand \index{RPM}
\end_inset
based distributions
\begin_inset LatexCommand \index{distributions}
\end_inset
(Redhat/Mandriva/SuSE).
\layout Description
\noindent
Changing\SpecialChar ~
root's\SpecialChar ~
password
\begin_inset LatexCommand \index{password}
\end_inset
This trick
\begin_inset LatexCommand \index{trick}
\end_inset
works
\begin_inset LatexCommand \index{works}
\end_inset
well if you have forgotten
\begin_inset LatexCommand \index{forgotten}
\end_inset
your superuser
\begin_inset LatexCommand \index{superuser}
\end_inset
password, type
\emph on
linux
\begin_inset LatexCommand \index{linux}
\end_inset
single
\emph default
at a LILO/Grub prompt.
\begin_inset LatexCommand \index{prompt}
\end_inset
Then
\emph on
passwd
\emph default
once the system
\begin_inset LatexCommand \index{system}
\end_inset
has started
\begin_inset LatexCommand \index{started}
\end_inset
and you are at a console.
\begin_inset LatexCommand \index{console}
\end_inset
\begin_deeper
\layout Description
\noindent
Grub: If you are using grub
\begin_inset LatexCommand \index{grub}
\end_inset
go to the relevant
\begin_inset LatexCommand \index{relevant}
\end_inset
line (the one with the kernel
\begin_inset LatexCommand \index{kernel}
\end_inset
and various options) then press
\begin_inset LatexCommand \index{press}
\end_inset
'e' for edit
\begin_inset LatexCommand \index{edit}
\end_inset
and add
\begin_inset LatexCommand \index{add}
\end_inset
\begin_inset Quotes eld
\end_inset
single
\begin_inset Quotes erd
\end_inset
on to the end
\begin_inset LatexCommand \index{end}
\end_inset
of the section
\begin_inset LatexCommand \index{section}
\end_inset
that boots
\begin_inset LatexCommand \index{boots}
\end_inset
the kernel.
\begin_inset LatexCommand \index{kernel}
\end_inset
Then hit
\begin_inset LatexCommand \index{hit}
\end_inset
[Enter] and press
\begin_inset LatexCommand \index{press}
\end_inset
'b' (to boot).
\layout Description
\noindent
Lilo: If you are using lilo
\begin_inset LatexCommand \index{lilo}
\end_inset
press escape
\begin_inset LatexCommand \index{escape}
\end_inset
and type
\begin_inset Quotes eld
\end_inset
linux
\begin_inset LatexCommand \index{linux}
\end_inset
single
\begin_inset Quotes erd
\end_inset
and then hit
\begin_inset LatexCommand \index{hit}
\end_inset
[Enter] to boot.
\begin_inset LatexCommand \index{boot}
\end_inset
\end_deeper
\layout SGML
\noindent
\layout SGML
\noindent
Security Warning
\layout SGML
\noindent
\layout SGML
\noindent
This is also a basic security hazard if you have others using your computer
and security is a concern, you may like to add a password to your LILO
or Grub prompt to stop this from being done.
\layout SGML
\noindent
\layout SGML
\noindent
\layout Standard
\noindent
\begin_inset Note
collapsed false
\layout Standard
maybe I should work out how\SpecialChar \ldots{}
--doesn't seem to be easy though!
\end_inset
\layout Description
\noindent
umask The umask
\begin_inset LatexCommand \index{umask}
\end_inset
is a value
\begin_inset LatexCommand \index{value}
\end_inset
set
\begin_inset LatexCommand \index{set}
\end_inset
by the root
\begin_inset LatexCommand \index{root}
\end_inset
user
\begin_inset LatexCommand \index{user}
\end_inset
of the system.
\begin_inset LatexCommand \index{system}
\end_inset
It controls
\begin_inset LatexCommand \index{controls}
\end_inset
the default
\begin_inset LatexCommand \index{default}
\end_inset
permissions of any file
\begin_inset LatexCommand \index{file}
\end_inset
created.
\begin_deeper
\layout Standard
\noindent
It has an unusual way of doing things \SpecialChar \ldots{}
to set
\begin_inset LatexCommand \index{set}
\end_inset
the umask
\begin_inset LatexCommand \index{umask}
\end_inset
you must
\begin_inset LatexCommand \index{must}
\end_inset
describe
\begin_inset LatexCommand \index{describe}
\end_inset
file
\begin_inset LatexCommand \index{file}
\end_inset
permissions
\begin_inset LatexCommand \index{permissions}
\end_inset
by saying what will be disabled.
\begin_inset LatexCommand \index{disabled}
\end_inset
\layout Standard
\noindent
You can do this by doing 777 minus
\begin_inset LatexCommand \index{minus}
\end_inset
the file
\begin_inset LatexCommand \index{file}
\end_inset
permissions
\begin_inset LatexCommand \index{permissions}
\end_inset
you want.
Note that
\emph on
umask
\emph default
works
\begin_inset LatexCommand \index{works}
\end_inset
with numbers
\begin_inset LatexCommand \index{numbers}
\end_inset
only, for an explanation
\begin_inset LatexCommand \index{explanation}
\end_inset
see
\begin_inset LatexCommand \ref{file-permissions}
\end_inset
\layout Standard
\noindent
Example:
\layout Standard
\noindent
You want the default
\begin_inset LatexCommand \index{default}
\end_inset
to be equivalent
\begin_inset LatexCommand \index{equivalent}
\end_inset
to
\emph on
chmod
\begin_inset LatexCommand \index{chmod}
\end_inset
750
\emph default
(user has r/w/x, group
\begin_inset LatexCommand \index{group}
\end_inset
has r/x and other has no permissions), then the command
\begin_inset LatexCommand \index{command}
\end_inset
you would use would be:
\layout Code
\noindent
umask 027
\end_deeper
\layout Section
\noindent
Some basic Security Tools
\begin_inset LatexCommand \label{some-basic-security-tools}
\end_inset
\layout Standard
\noindent
\begin_inset Note
collapsed true
\layout Standard
is cksum superseeded by md5sum? --possibly remove this
\layout Description
cksum Compute the CRC (
\begin_inset Quotes eld
\end_inset
cyclic redundancy check
\begin_inset Quotes erd
\end_inset
) for file
\emph on
\shape italic
\begin_inset Quotes eld
\end_inset
file_name
\begin_inset Quotes erd
\end_inset
\shape default
\emph default
to verify it's integrity, used as both a security check (if it doesn't match
the file's being tampered with) or can be used to check if the file is
corrupted or not.
\begin_deeper
\layout Standard
Command syntax:
\layout Code
cksum file_name
\end_inset
\layout Description
\noindent
md5sum
\begin_inset LatexCommand \index{md5sum}
\end_inset
Compute an md5
\begin_inset LatexCommand \index{md5}
\end_inset
checksum (128-bit) for file
\begin_inset LatexCommand \index{file}
\end_inset
\begin_inset Quotes eld
\end_inset
file_name
\begin_inset Quotes erd
\end_inset
to verify
\begin_inset LatexCommand \index{verify}
\end_inset
it's integrity.
\begin_inset LatexCommand \index{integrity}
\end_inset
You normally use the
\begin_inset Quotes eld
\end_inset
md5sum
\begin_inset LatexCommand \index{md5sum}
\end_inset
-c
\begin_inset Quotes erd
\end_inset
option
\begin_inset LatexCommand \index{option}
\end_inset
to check
\begin_inset LatexCommand \index{check}
\end_inset
against a given file
\begin_inset LatexCommand \index{file}
\end_inset
(often with a
\begin_inset Quotes eld
\end_inset
.asc
\begin_inset Quotes erd
\end_inset
extention) to check
\begin_inset LatexCommand \index{check}
\end_inset
whether the various files
\begin_inset LatexCommand \index{files}
\end_inset
are correct,
\begin_inset LatexCommand \index{correct}
\end_inset
this comes in handy
\begin_inset LatexCommand \index{handy}
\end_inset
when downloading
\begin_inset LatexCommand \index{downloading}
\end_inset
isos as the checking
\begin_inset LatexCommand \index{checking}
\end_inset
is automated
\begin_inset LatexCommand \index{automated}
\end_inset
for you.
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
md5sum file_name
\end_deeper
\layout Description
\noindent
mkpasswd\SpecialChar ~
-l\SpecialChar ~
10
\begin_inset LatexCommand \index{mkpasswd}
\end_inset
This command
\begin_inset LatexCommand \index{command}
\end_inset
will make a random
\begin_inset LatexCommand \index{random}
\end_inset
password
\begin_inset LatexCommand \index{password}
\end_inset
of length
\begin_inset LatexCommand \index{length}
\end_inset
ten characters.
\begin_inset LatexCommand \index{characters}
\end_inset
This password
\begin_inset LatexCommand \index{password}
\end_inset
generator
\begin_inset LatexCommand \index{generator}
\end_inset
creates passwords
\begin_inset LatexCommand \index{passwords}
\end_inset
that are designed
\begin_inset LatexCommand \index{designed}
\end_inset
to be hard to guess.
\begin_inset LatexCommand \index{guess}
\end_inset
There are similar
\begin_inset LatexCommand \index{similar}
\end_inset
alternatives
\begin_inset LatexCommand \index{alternatives}
\end_inset
to this program
\begin_inset LatexCommand \index{program}
\end_inset
scattered
\begin_inset LatexCommand \index{scattered}
\end_inset
around the internet.
\begin_inset LatexCommand \index{internet}
\end_inset
\layout Section
File Permissions
\begin_inset LatexCommand \label{file-permissions}
\end_inset
\layout Standard
\noindent
Use
\emph on
ls
\begin_inset LatexCommand \index{ls}
\end_inset
-l
\emph default
to see the permissions
\begin_inset LatexCommand \index{permissions}
\end_inset
of files
\begin_inset LatexCommand \index{files}
\end_inset
(list-long).
They will appear like this, note that I have added spaces
\begin_inset LatexCommand \index{spaces}
\end_inset
between permissions
\begin_inset LatexCommand \index{permissions}
\end_inset
to make it easier to read:
\begin_inset LatexCommand \index{read}
\end_inset
\layout Standard
Where: r
\begin_inset LatexCommand \index{r}
\end_inset
= read,
\begin_inset LatexCommand \index{read}
\end_inset
w
\begin_inset LatexCommand \index{w}
\end_inset
= write,
\begin_inset LatexCommand \index{write}
\end_inset
x = execute
\begin_inset LatexCommand \index{execute}
\end_inset
\layout SGML
\layout SGML
- rwx rw- r-- 1 newuser newuser
\layout SGML
\noindent
typeownergroupothers
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
This number is the number of hard links (pointers) to this file.
You can use
\emph on
ln
\emph default
to create another hard-link to the file.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
This is the type of file.
'-' means a regular file, 'd' would mean a directory, 'l' would mean a
link.
There are also other types such as 'c' for character device and 'b' for
block device (found in the /dev/ directory).
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
These are the permissions for the owner of the file (the user who created
the file).
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
These are the permissions for the group, any users who belong is the
same group as the user who created the file will have these permissions.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
\layout SGML
These are the permissions for everyone else.
Any user who is outside the group will have these permissions to the file.
\layout SGML
\layout SGML
\layout SGML
\layout Standard
\noindent
The two names at the end
\begin_inset LatexCommand \index{end}
\end_inset
are the username
\begin_inset LatexCommand \index{username}
\end_inset
and group
\begin_inset LatexCommand \index{group}
\end_inset
respectively.
\begin_inset LatexCommand \index{respectively}
\end_inset
\layout Description
\noindent
chmod
\begin_inset LatexCommand \index{chmod}
\end_inset
Change
\begin_inset LatexCommand \index{Change}
\end_inset
file access
\begin_inset LatexCommand \index{access}
\end_inset
permissions for a file(s).
\begin_deeper
\layout Standard
\noindent
There are two methods
\begin_inset LatexCommand \index{methods}
\end_inset
to change
\begin_inset LatexCommand \index{change}
\end_inset
permissions using
\emph on
chmod
\emph default
; letters
\begin_inset LatexCommand \index{letters}
\end_inset
or numbers.
\begin_inset LatexCommand \index{numbers}
\end_inset
\layout Description
Letters\SpecialChar ~
Method: use a + or - (plus or minus
\begin_inset LatexCommand \index{minus}
\end_inset
sign) to add
\begin_inset LatexCommand \index{add}
\end_inset
or remove
\begin_inset LatexCommand \index{remove}
\end_inset
permissions for a file.
\begin_inset LatexCommand \index{file}
\end_inset
Use an equals
\begin_inset LatexCommand \index{equals}
\end_inset
sign =, to specify
\begin_inset LatexCommand \index{specify}
\end_inset
new
\begin_inset LatexCommand \index{new}
\end_inset
permissions and remove
\begin_inset LatexCommand \index{remove}
\end_inset
the old
\begin_inset LatexCommand \index{old}
\end_inset
ones for the particular
\begin_inset LatexCommand \index{particular}
\end_inset
type of user(s).
\begin_deeper
\layout Standard
You can use
\emph on
chmod
\begin_inset LatexCommand \index{chmod}
\end_inset
letter
\emph default
where the letters
\begin_inset LatexCommand \index{letters}
\end_inset
are:
\layout Standard
\emph on
a
\emph default
(all (everyone))
\emph on
, u
\emph default
(user)
\emph on
,
\emph default
\emph on
g
\emph default
(group) and
\emph on
o
\emph default
(other).
\end_deeper
\layout Standard
Examples:
\layout Code
chmod u+rw somefile
\layout Standard
This would give the user
\begin_inset LatexCommand \index{user}
\end_inset
read and write
\begin_inset LatexCommand \index{write}
\end_inset
permission.
\layout Code
chmod o-rwx somefile
\layout Standard
This will remove
\begin_inset LatexCommand \index{remove}
\end_inset
read/write/execute permissions
\begin_inset LatexCommand \index{permissions}
\end_inset
from other users
\begin_inset LatexCommand \index{users}
\end_inset
(doesn't include
\begin_inset LatexCommand \index{include}
\end_inset
users within your group).
\layout Code
chmod a+r
\emph on
\emph default
somefile
\layout Standard
This will give everyone
\begin_inset LatexCommand \index{everyone}
\end_inset
read permission
\begin_inset LatexCommand \index{permission}
\end_inset
for the file.
\begin_inset LatexCommand \index{file}
\end_inset
\layout Code
chmod a=rx somefile
\layout Standard
This would give everyone
\begin_inset LatexCommand \index{everyone}
\end_inset
execute and read
\begin_inset LatexCommand \index{read}
\end_inset
permission
\begin_inset LatexCommand \index{permission}
\end_inset
to the file,
\begin_inset LatexCommand \index{file}
\end_inset
if anyone had write
\begin_inset LatexCommand \index{write}
\end_inset
permission it would be removed.
\layout Description
Numbers\SpecialChar ~
Method: you can also use numbers
\begin_inset LatexCommand \index{numbers}
\end_inset
(instead of letters) to change
\begin_inset LatexCommand \index{change}
\end_inset
file permissions.
\begin_inset LatexCommand \index{permissions}
\end_inset
Where:
\begin_deeper
\layout Standard
r
\begin_inset LatexCommand \index{r}
\end_inset
(read) = 4
\hfill
w
\begin_inset LatexCommand \index{w}
\end_inset
(write) = 2
\hfill
x (execute) = 1
\end_deeper
\layout Standard
\noindent
Numbers
\begin_inset LatexCommand \index{Numbers}
\end_inset
can be added together
\begin_inset LatexCommand \index{together}
\end_inset
so you can specify
\begin_inset LatexCommand \index{specify}
\end_inset
read/write/execute permissions;
\begin_inset LatexCommand \index{permissions}
\end_inset
read+write = 6, read+execute = 5, read+write+execute = 7
\layout Standard
\noindent
Examples:
\layout Code
\noindent
chmod 777 somefile
\layout Standard
\noindent
This would give everyone
\begin_inset LatexCommand \index{everyone}
\end_inset
read/write/execute permission
\begin_inset LatexCommand \index{permission}
\end_inset
on
\begin_inset Quotes eld
\end_inset
this_file
\begin_inset Quotes erd
\end_inset
.
The first number
\begin_inset LatexCommand \index{number}
\end_inset
is user,
\begin_inset LatexCommand \index{user}
\end_inset
second is group
\begin_inset LatexCommand \index{group}
\end_inset
and third is everyone
\begin_inset LatexCommand \index{everyone}
\end_inset
else (other).
\layout Code
chmod 521 somefile
\layout Standard
This would give the user
\begin_inset LatexCommand \index{user}
\end_inset
read and execute
\begin_inset LatexCommand \index{execute}
\end_inset
permission,
\begin_inset LatexCommand \index{permission}
\end_inset
and the group
\begin_inset LatexCommand \index{group}
\end_inset
write
\begin_inset LatexCommand \index{write}
\end_inset
permission
\begin_inset LatexCommand \index{permission}
\end_inset
(but not read
\begin_inset LatexCommand \index{read}
\end_inset
permission!) and everyone
\begin_inset LatexCommand \index{everyone}
\end_inset
else execute
\begin_inset LatexCommand \index{execute}
\end_inset
permission.
(Note that it's just an example, settings like that don't really make sense\SpecialChar \ldots{}
).
\end_deeper
\layout Description
\noindent
chown
\begin_inset LatexCommand \index{chown}
\end_inset
Changes the ownership
\begin_inset LatexCommand \index{ownership}
\end_inset
rights
\begin_inset LatexCommand \index{rights}
\end_inset
of a file
\begin_inset LatexCommand \index{file}
\end_inset
(hence the name 'chown' - change
\begin_inset LatexCommand \index{change}
\end_inset
owner).
This program
\begin_inset LatexCommand \index{program}
\end_inset
can only be used by root.
\begin_inset LatexCommand \index{root}
\end_inset
\begin_deeper
\layout Standard
\noindent
Use the
\emph on
-R
\begin_inset LatexCommand \index{-R}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to change
\begin_inset LatexCommand \index{change}
\end_inset
things recursively,
\begin_inset LatexCommand \index{recursively}
\end_inset
in other words,
\begin_inset LatexCommand \index{words}
\end_inset
all matching
\begin_inset LatexCommand \index{matching}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
including
\begin_inset LatexCommand \index{including}
\end_inset
those in subdirectories.
\begin_inset LatexCommand \index{subdirectories}
\end_inset
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
\noindent
chown owner:group the_file_name
\end_deeper
\layout Description
\noindent
sticky\SpecialChar ~
\begin_inset LatexCommand \index{ bit, sticky}
\end_inset
\begin_inset LatexCommand \index{ sticky}
\end_inset
bit
\begin_inset LatexCommand \index{bit}
\end_inset
Only the person
\begin_inset LatexCommand \index{person}
\end_inset
who created the file
\begin_inset LatexCommand \index{file}
\end_inset
may delete
\begin_inset LatexCommand \index{delete}
\end_inset
it, even
\begin_inset LatexCommand \index{even}
\end_inset
if other people
\begin_inset LatexCommand \index{people}
\end_inset
have write
\begin_inset LatexCommand \index{write}
\end_inset
permission.
You can turn
\begin_inset LatexCommand \index{turn}
\end_inset
it on by typing:
\begin_deeper
\layout Code
chmod 1700
\emph on
\emph default
somefile
\family roman
(where 1 = sticky bit)
\layout Standard
or (where
\emph on
t
\emph default
represents
\begin_inset LatexCommand \index{represents}
\end_inset
the sticky
\begin_inset LatexCommand \index{sticky}
\end_inset
bit)
\layout Code
chmod +t somefile
\layout Standard
To turn
\begin_inset LatexCommand \index{turn}
\end_inset
it off
\begin_inset LatexCommand \index{off}
\end_inset
you would need to type:
\layout Code
chmod 0700 somefile
\family roman
(where the zero would mean no sticky bit)
\layout Standard
or (where
\emph on
t
\emph default
represents
\begin_inset LatexCommand \index{represents}
\end_inset
the sticky
\begin_inset LatexCommand \index{sticky}
\end_inset
bit)
\layout Code
chmod -t somefile
\layout Standard
Note that the permissions
\begin_inset LatexCommand \index{permissions}
\end_inset
aren't relevant
\begin_inset LatexCommand \index{relevant}
\end_inset
in the numbers
\begin_inset LatexCommand \index{numbers}
\end_inset
example,
\begin_inset LatexCommand \index{example}
\end_inset
only the first number
\begin_inset LatexCommand \index{number}
\end_inset
(1 = on, 0 = off).
\layout SGML
\layout SGML
Sticky Directories
\layout SGML
\layout SGML
You may also have sticky directories, the /tmp directory is usually an example
of a sticky directory.
\layout SGML
\layout SGML
\layout SGML
The files inside can only be deleted by the super-user (root) or the creator
of the file.
\layout SGML
\layout SGML
\layout SGML
Sticky directories will show a 't' at the end of their file permissions
(when listed using
\emph on
ls -l
\emph default
).
This may be useful when you have a directory that everyone has access to
but no-one should be deleting each others files.
\layout SGML
\layout SGML
\end_deeper
\layout Description
\noindent
\series bold
suid
\series default
Allow SUID/SGID (switch user
\begin_inset LatexCommand \index{user}
\end_inset
ID/switch group
\begin_inset LatexCommand \index{group}
\end_inset
ID) access.
\begin_inset LatexCommand \index{access}
\end_inset
You would normally use
\emph on
chmod
\emph default
to turn
\begin_inset LatexCommand \index{turn}
\end_inset
this on or off
\begin_inset LatexCommand \index{off}
\end_inset
for a particular
\begin_inset LatexCommand \index{particular}
\end_inset
file, suid
\begin_inset LatexCommand \index{suid}
\end_inset
is generally considered a security
\begin_inset LatexCommand \index{security}
\end_inset
hazard so be careful
\begin_inset LatexCommand \index{careful}
\end_inset
when using this.
\begin_deeper
\layout Standard
\noindent
Example:
\layout Code
chmod a+s file_name
\layout Standard
This will give everyone
\begin_inset LatexCommand \index{everyone}
\end_inset
permission
\begin_inset LatexCommand \index{permission}
\end_inset
to execute
\begin_inset LatexCommand \index{execute}
\end_inset
the file
\begin_inset LatexCommand \index{file}
\end_inset
with the permissions
\begin_inset LatexCommand \index{permissions}
\end_inset
of the user
\begin_inset LatexCommand \index{user}
\end_inset
who set
\begin_inset LatexCommand \index{set}
\end_inset
the +s switch.
\begin_inset LatexCommand \index{switch}
\end_inset
\layout SGML
\layout SGML
\layout SGML
Security Hazard
\layout SGML
\layout SGML
\layout SGML
This is obviously a security hazard.
You should avoid using the suid flag unless necessary.
\layout SGML
\layout SGML
\end_deeper
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
this can all be done with numbers, the first number 0777 (the 0 is the number
which controls this, there are numbers 0-7 which do stuff.
See the ibm developerworks tutorial, I think its the third one on LPI 101
certification.
\end_inset
\layout Description
\noindent
chattr Change file system attributes (works on ext2fs and possibly others\SpecialChar \ldots{}
).
Use the
\emph on
-R
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to change
\begin_inset LatexCommand \index{change}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
recursively,
\emph on
chattr
\begin_inset LatexCommand \index{chattr}
\end_inset
\emph default
has a large number
\begin_inset LatexCommand \index{number}
\end_inset
of attributes
\begin_inset LatexCommand \index{attributes}
\end_inset
which can be set
\begin_inset LatexCommand \index{set}
\end_inset
on a file,
\begin_inset LatexCommand \index{file}
\end_inset
read
\begin_inset LatexCommand \index{read}
\end_inset
the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
for further information.
\begin_inset LatexCommand \index{information}
\end_inset
\begin_deeper
\layout Standard
\noindent
Example:
\layout Code
\noindent
chattr +i /sbin/lilo.conf
\begin_inset Foot
collapsed false
\layout Standard
This example and tiny parts of the explanation have been taken from the
Linux Online Classroom, see [4] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
\layout Standard
\noindent
This sets
\begin_inset LatexCommand \index{sets}
\end_inset
the 'immutable' flag
\begin_inset LatexCommand \index{flag}
\end_inset
on a file.
\begin_inset LatexCommand \index{file}
\end_inset
Use a '+' to add
\begin_inset LatexCommand \index{add}
\end_inset
attributes
\begin_inset LatexCommand \index{attributes}
\end_inset
and a '-' to take
\begin_inset LatexCommand \index{take}
\end_inset
them away.
The +i will prevent
\begin_inset LatexCommand \index{prevent}
\end_inset
any changes (accidental or otherwise) to the
\begin_inset Quotes eld
\end_inset
lilo.conf
\begin_inset Quotes erd
\end_inset
file.
\begin_inset LatexCommand \index{file}
\end_inset
If you wish to modify
\begin_inset LatexCommand \index{modify}
\end_inset
the lilo.
\begin_inset LatexCommand \index{lilo}
\end_inset
conf file
\begin_inset LatexCommand \index{file}
\end_inset
you will need to unset
\begin_inset LatexCommand \index{unset}
\end_inset
the immutable
\begin_inset LatexCommand \index{immutable}
\end_inset
flag:
\begin_inset LatexCommand \index{flag}
\end_inset
\emph on
chattr
\begin_inset LatexCommand \index{chattr}
\end_inset
-i
\emph default
.
Note some flags
\begin_inset LatexCommand \index{flags}
\end_inset
can only be used by root;
\begin_inset LatexCommand \index{root}
\end_inset
\emph on
-i
\emph default
,
\emph on
-a
\emph default
and probably
\begin_inset LatexCommand \index{probably}
\end_inset
many others.
\layout Standard
\noindent
Note there are many different
\begin_inset LatexCommand \index{different}
\end_inset
attributes
\begin_inset LatexCommand \index{attributes}
\end_inset
that chattr
\begin_inset LatexCommand \index{chattr}
\end_inset
can change,
\begin_inset LatexCommand \index{change}
\end_inset
here are a few more
\begin_inset LatexCommand \index{more}
\end_inset
which
\begin_inset LatexCommand \index{which}
\end_inset
may be useful:
\layout Itemize
\series bold
A
\series default
(no Access
\begin_inset LatexCommand \index{Access}
\end_inset
time) --- if a file
\begin_inset LatexCommand \index{file}
\end_inset
or directory
\begin_inset LatexCommand \index{directory}
\end_inset
has this attribute
\begin_inset LatexCommand \index{attribute}
\end_inset
set,
\begin_inset LatexCommand \index{set}
\end_inset
whenever it is accessed,
\begin_inset LatexCommand \index{accessed}
\end_inset
either for reading
\begin_inset LatexCommand \index{reading}
\end_inset
of for writing,
\begin_inset LatexCommand \index{writing}
\end_inset
it's last
\begin_inset LatexCommand \index{last}
\end_inset
access time
\begin_inset LatexCommand \index{time}
\end_inset
will not be updated.
\begin_inset LatexCommand \index{updated}
\end_inset
This can be useful, for example,
\begin_inset LatexCommand \index{example}
\end_inset
on files
\begin_inset LatexCommand \index{files}
\end_inset
or directories
\begin_inset LatexCommand \index{directories}
\end_inset
which are very often accessed
\begin_inset LatexCommand \index{accessed}
\end_inset
for reading,
\begin_inset LatexCommand \index{reading}
\end_inset
especially
\begin_inset LatexCommand \index{especially}
\end_inset
since this parameter
\begin_inset LatexCommand \index{parameter}
\end_inset
is the only one which
\begin_inset LatexCommand \index{which}
\end_inset
changes on an inode
\begin_inset LatexCommand \index{inode}
\end_inset
when it's opened
\begin_inset LatexCommand \index{opened}
\end_inset
read-only.
\layout Itemize
\series bold
a
\series default
(append only) --- if a file
\begin_inset LatexCommand \index{file}
\end_inset
has this attribute
\begin_inset LatexCommand \index{attribute}
\end_inset
set
\begin_inset LatexCommand \index{set}
\end_inset
and is open
\begin_inset LatexCommand \index{open}
\end_inset
for writing,
\begin_inset LatexCommand \index{writing}
\end_inset
the only operation
\begin_inset LatexCommand \index{operation}
\end_inset
possible will be to append
\begin_inset LatexCommand \index{append}
\end_inset
data
\begin_inset LatexCommand \index{data}
\end_inset
to it's previous
\begin_inset LatexCommand \index{previous}
\end_inset
contents.
For a directory,
\begin_inset LatexCommand \index{directory}
\end_inset
this means that you can only add
\begin_inset LatexCommand \index{add}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
to it, but not rename
\begin_inset LatexCommand \index{rename}
\end_inset
or delete
\begin_inset LatexCommand \index{delete}
\end_inset
any existing
\begin_inset LatexCommand \index{existing}
\end_inset
file.
Only root
\begin_inset LatexCommand \index{root}
\end_inset
can set
\begin_inset LatexCommand \index{set}
\end_inset
or clear this attribute.
\begin_inset LatexCommand \index{attribute}
\end_inset
\layout Itemize
\series bold
s
\series default
(secure deletion) --- when such a file
\begin_inset LatexCommand \index{file}
\end_inset
or directory
\begin_inset LatexCommand \index{directory}
\end_inset
with this attribute
\begin_inset LatexCommand \index{attribute}
\end_inset
set
\begin_inset LatexCommand \index{set}
\end_inset
is deleted,
\begin_inset LatexCommand \index{deleted}
\end_inset
the blocks
\begin_inset LatexCommand \index{blocks}
\end_inset
it was occupying
\begin_inset LatexCommand \index{occupying}
\end_inset
on disk
\begin_inset LatexCommand \index{disk}
\end_inset
are written
\begin_inset LatexCommand \index{written}
\end_inset
back with zeroes
\begin_inset LatexCommand \index{zeroes}
\end_inset
(similar to using
\emph on
shred
\emph default
).
Note that this does work
\begin_inset LatexCommand \index{work}
\end_inset
on the ext2,
\begin_inset LatexCommand \index{ext2}
\end_inset
and ext3
\begin_inset LatexCommand \index{ext3}
\end_inset
filesystems
\begin_inset LatexCommand \index{filesystems}
\end_inset
but is unlikely
\begin_inset LatexCommand \index{unlikely}
\end_inset
to work
\begin_inset LatexCommand \index{work}
\end_inset
on others (please see the documentation
\begin_inset LatexCommand \index{documentation}
\end_inset
for the filesystem
\begin_inset LatexCommand \index{filesystem}
\end_inset
you are using).
Or try
\begin_inset LatexCommand \index{try}
\end_inset
using shred
\begin_inset LatexCommand \index{shred}
\end_inset
when you want to delete
\begin_inset LatexCommand \index{delete}
\end_inset
the file
\begin_inset LatexCommand \index{file}
\end_inset
see
\begin_inset LatexCommand \ref{Working-with-the-file-system}
\end_inset
\end_deeper
\layout Description
lsattr
\begin_inset LatexCommand \index{lsattr}
\end_inset
(list attributes).
This will list
\begin_inset LatexCommand \index{list}
\end_inset
if whether a file
\begin_inset LatexCommand \index{file}
\end_inset
has any special
\begin_inset LatexCommand \index{special}
\end_inset
attributes (as set
\begin_inset LatexCommand \index{set}
\end_inset
by chattr).
Use the
\emph on
-R
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to list
\begin_inset LatexCommand \index{list}
\end_inset
recursively
\begin_inset LatexCommand \index{recursively}
\end_inset
and try
\begin_inset LatexCommand \index{try}
\end_inset
using the
\emph on
-d
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to list
\begin_inset LatexCommand \index{list}
\end_inset
directories
\begin_inset LatexCommand \index{directories}
\end_inset
like other files
\begin_inset LatexCommand \index{files}
\end_inset
rather than listing
\begin_inset LatexCommand \index{listing}
\end_inset
their contents.
\begin_inset LatexCommand \index{contents}
\end_inset
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
lsattr
\layout Standard
This will list
\begin_inset LatexCommand \index{list}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory,
\begin_inset LatexCommand \index{directory}
\end_inset
you may also like to specify
\begin_inset LatexCommand \index{specify}
\end_inset
a directory
\begin_inset LatexCommand \index{directory}
\end_inset
or a file:
\begin_inset LatexCommand \index{file}
\end_inset
\layout Code
lsattr /directory/or/file
\end_deeper
\layout Chapter
Archiving Files
\begin_inset LatexCommand \label{Backing-up-files}
\end_inset
\layout Standard
The archiving
\begin_inset LatexCommand \index{archiving}
\end_inset
files chapter provides
\begin_inset LatexCommand \index{provides}
\end_inset
some basic
\begin_inset LatexCommand \index{basic}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on the simple programs
\begin_inset LatexCommand \index{programs}
\end_inset
that you can use to archive
\begin_inset LatexCommand \index{archive}
\end_inset
files.
\begin_inset LatexCommand \index{files}
\end_inset
You will often see these programs
\begin_inset LatexCommand \index{programs}
\end_inset
used when you try
\begin_inset LatexCommand \index{try}
\end_inset
to install
\begin_inset LatexCommand \index{install}
\end_inset
programs without using a package
\begin_inset LatexCommand \index{package}
\end_inset
management tool.
\begin_inset LatexCommand \index{tool}
\end_inset
\layout SGML
\layout SGML
This is not a backup guide
\layout SGML
Please note that while
\emph on
tar
\emph default
is useful for regular purposes, and possibly combined with bash sciprting
or similar it can become useful, it is not a great program for performing
real backups of data.
\layout SGML
You should try searching the internet if you are looking for backup
programs on GNU/Linux or try
\begin_inset LatexCommand \url[Sourceforge]{https://sourceforge.net}
\end_inset
or
\begin_inset LatexCommand \url[Freshmeat]{https://freshmeat.net}
\end_inset
for programs that you can use.
You may also like to see rsync,
\begin_inset LatexCommand \ref{rsync}
\end_inset
.
\layout SGML
\layout Section
tar (tape archiver)
\begin_inset LatexCommand \label{tar}
\end_inset
\layout Standard
Type
\emph on
tar
\emph default
then
\emph on
-option(s)
\layout Standard
Options
\begin_inset LatexCommand \index{Options}
\end_inset
list:
\begin_inset LatexCommand \index{list}
\end_inset
\layout Itemize
\noindent
\shape italic
c
\shape default
\begin_inset LatexCommand \index{default}
\end_inset
--- create.
\layout Itemize
\noindent
\shape italic
v
\shape default
\begin_inset LatexCommand \index{default}
\end_inset
--- verbose,
\begin_inset LatexCommand \index{verbose}
\end_inset
give more
\begin_inset LatexCommand \index{more}
\end_inset
output,
\begin_inset LatexCommand \index{output}
\end_inset
show
\begin_inset LatexCommand \index{show}
\end_inset
what files
\begin_inset LatexCommand \index{files}
\end_inset
are being worked with (extracted or added).
\layout Itemize
\noindent
\shape italic
f
\series bold
\series default
\shape default
\begin_inset LatexCommand \index{default}
\end_inset
--- file
\begin_inset LatexCommand \index{file}
\end_inset
(create or extract
\begin_inset LatexCommand \index{extract}
\end_inset
from file) - should always be the last
\begin_inset LatexCommand \index{last}
\end_inset
option otherwise the command
\begin_inset LatexCommand \index{command}
\end_inset
will not work.
\begin_inset LatexCommand \index{work}
\end_inset
\layout Itemize
\noindent
\shape italic
z
\shape default
\begin_inset LatexCommand \index{default}
\end_inset
--- put the file
\begin_inset LatexCommand \index{file}
\end_inset
though gzip
\begin_inset LatexCommand \index{gzip}
\end_inset
or use gunzip
\begin_inset LatexCommand \index{gunzip}
\end_inset
on the file
\begin_inset LatexCommand \index{file}
\end_inset
first.
\layout Itemize
\noindent
\shape italic
x
\shape default
\begin_inset LatexCommand \index{default}
\end_inset
--- extract
\begin_inset LatexCommand \index{extract}
\end_inset
the files
\begin_inset LatexCommand \index{files}
\end_inset
from the tarball.
\begin_inset LatexCommand \index{tarball}
\end_inset
\layout Itemize
\noindent
\shape italic
p
\shape default
\begin_inset LatexCommand \index{default}
\end_inset
--- preserves
\begin_inset LatexCommand \index{preserves}
\end_inset
dates,
\begin_inset LatexCommand \index{dates}
\end_inset
permissions
\begin_inset LatexCommand \index{permissions}
\end_inset
of the original
\begin_inset LatexCommand \index{original}
\end_inset
files.
\begin_inset LatexCommand \index{files}
\end_inset
\layout Itemize
\noindent
\shape italic
j
\shape default
\begin_inset LatexCommand \index{default}
\end_inset
--- send
\begin_inset LatexCommand \index{send}
\end_inset
archive through bzip2.
\begin_inset LatexCommand \index{bzip2}
\end_inset
\layout Itemize
\noindent
--exclude=pattern --- this will stop
\begin_inset LatexCommand \index{stop}
\end_inset
certain files
\begin_inset LatexCommand \index{files}
\end_inset
from being archived
\begin_inset LatexCommand \index{archived}
\end_inset
(using a standard
\begin_inset LatexCommand \index{standard}
\end_inset
wild
\begin_inset LatexCommand \index{wild}
\end_inset
card pattern) or a single file
\begin_inset LatexCommand \index{file}
\end_inset
name.
\layout Description
\noindent
tar\SpecialChar ~
examples
\begin_deeper
\layout Code
tar -cvpf name_of_file.tar files_to_be_backed_up
\layout Standard
This would create a tape
\begin_inset LatexCommand \index{tape}
\end_inset
archive (no compressing).
\layout Code
tar -zxvpf my_tar_file.tar.gz
\layout Standard
This would extract
\begin_inset LatexCommand \index{extract}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
(verbosely) from a gzipped
\begin_inset LatexCommand \index{gzipped}
\end_inset
tape
\begin_inset LatexCommand \index{tape}
\end_inset
archive.
\end_deeper
\layout Section
rsync
\begin_inset LatexCommand \label{rsync}
\end_inset
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
rsync has good documentation no point recreating it :P
\end_inset
\layout Description
rsync
\begin_inset LatexCommand \index{rsync}
\end_inset
\emph on
rsync
\emph default
is a replacement
\begin_inset LatexCommand \index{replacement}
\end_inset
for the old
\begin_inset LatexCommand \index{old}
\end_inset
\emph on
rcp
\emph default
(remote-copy) command.
\begin_inset LatexCommand \index{command}
\end_inset
It can use
\emph on
ssh
\emph default
for encryption
\begin_inset LatexCommand \index{encryption}
\end_inset
and is a very flexible
\begin_inset LatexCommand \index{flexible}
\end_inset
tool,
\begin_inset LatexCommand \index{tool}
\end_inset
it can copy
\begin_inset LatexCommand \index{copy}
\end_inset
from local
\begin_inset LatexCommand \index{local}
\end_inset
machine
\begin_inset LatexCommand \index{machine}
\end_inset
to local
\begin_inset LatexCommand \index{local}
\end_inset
machine,
\begin_inset LatexCommand \index{machine}
\end_inset
from local
\begin_inset LatexCommand \index{local}
\end_inset
to remote
\begin_inset LatexCommand \index{remote}
\end_inset
(and vice-versa), and to and from rsync
\begin_inset LatexCommand \index{rsync}
\end_inset
servers.
\begin_inset LatexCommand \index{servers}
\end_inset
\begin_deeper
\layout Standard
\emph on
rsync
\emph default
uses an advanced
\begin_inset LatexCommand \index{advanced}
\end_inset
differencing algorithm,
\begin_inset LatexCommand \index{algorithm}
\end_inset
so when to copies
\begin_inset LatexCommand \index{copies}
\end_inset
or syncs
\begin_inset LatexCommand \index{syncs}
\end_inset
something it will (a) only copy
\begin_inset LatexCommand \index{copy}
\end_inset
new/changed files
\begin_inset LatexCommand \index{files}
\end_inset
and (b) if the files
\begin_inset LatexCommand \index{files}
\end_inset
have being changed it will copy
\begin_inset LatexCommand \index{copy}
\end_inset
the differences
\begin_inset LatexCommand \index{differences}
\end_inset
between the files
\begin_inset LatexCommand \index{files}
\end_inset
(not the entire
\begin_inset LatexCommand \index{entire}
\end_inset
file).
Using this method
\begin_inset LatexCommand \index{method}
\end_inset
\emph on
rsync
\emph default
saves
\begin_inset LatexCommand \index{saves}
\end_inset
time
\begin_inset LatexCommand \index{time}
\end_inset
and bandwidth.
\begin_inset LatexCommand \index{bandwidth}
\end_inset
\layout Standard
\emph on
rsync
\emph default
also has advanced
\begin_inset LatexCommand \index{advanced}
\end_inset
exclusion options
\begin_inset LatexCommand \index{options}
\end_inset
similar to GNU
\begin_inset LatexCommand \index{GNU}
\end_inset
tar.
\begin_inset LatexCommand \index{tar}
\end_inset
\emph on
rsync
\emph default
has a well written
\begin_inset LatexCommand \index{written}
\end_inset
manual page,
\begin_inset LatexCommand \index{page}
\end_inset
for further information
\begin_inset LatexCommand \index{information}
\end_inset
read the
\emph on
rsync
\emph default
documentation
\begin_inset LatexCommand \index{documentation}
\end_inset
online or type:
\layout Code
man rsync
\layout Standard
If you wish to visit
\begin_inset LatexCommand \index{visit}
\end_inset
the rsync
\begin_inset LatexCommand \index{rsync}
\end_inset
site you will find
\begin_inset LatexCommand \index{find}
\end_inset
it over
\begin_inset LatexCommand \url[here]{https://www.samba.org/rsync/}
\end_inset
\end_deeper
\layout Section
Compression
\begin_inset LatexCommand \label{compression}
\end_inset
\layout Standard
There are two main compression
\begin_inset LatexCommand \index{compression}
\end_inset
utilities
\begin_inset LatexCommand \index{utilities}
\end_inset
used in GNU/Linux.
It's normal
\begin_inset LatexCommand \index{normal}
\end_inset
to first
\begin_inset Quotes eld
\end_inset
tar
\begin_inset Quotes erd
\end_inset
a bunch
\begin_inset LatexCommand \index{bunch}
\end_inset
of files
\begin_inset LatexCommand \index{files}
\end_inset
(using the
\emph on
tar
\emph default
program
\begin_inset LatexCommand \index{program}
\end_inset
of course) and then compress
\begin_inset LatexCommand \index{compress}
\end_inset
them with either
\emph on
bzip2
\emph default
or
\emph on
gzip
\emph default
.
Of course either of these tools
\begin_inset LatexCommand \index{tools}
\end_inset
could be used without tar,
\begin_inset LatexCommand \index{tar}
\end_inset
although they are not designed
\begin_inset LatexCommand \index{designed}
\end_inset
to work
\begin_inset LatexCommand \index{work}
\end_inset
on more
\begin_inset LatexCommand \index{more}
\end_inset
than one file
\begin_inset LatexCommand \index{file}
\end_inset
(they use the UNIX
\begin_inset LatexCommand \index{UNIX}
\end_inset
tools philosophy,
\begin_inset LatexCommand \index{philosophy}
\end_inset
let
\begin_inset LatexCommand \index{let}
\end_inset
\emph on
tar
\emph default
group the files, they will do the compression\SpecialChar \ldots{}
this simplifies their program).
It's normal
\begin_inset LatexCommand \index{normal}
\end_inset
to use
\emph on
tar
\emph default
and then use these tools
\begin_inset LatexCommand \index{tools}
\end_inset
on them, or use
\emph on
tar
\emph default
with the correct
\begin_inset LatexCommand \index{correct}
\end_inset
options to use these compression
\begin_inset LatexCommand \index{compression}
\end_inset
programs.
\begin_inset LatexCommand \index{programs}
\end_inset
\layout Description
GNU\SpecialChar ~
\series bold
zip
\series default
\SpecialChar ~
\series bold
(gzip)
\series default
gzip
\begin_inset LatexCommand \index{gzip}
\end_inset
is the GNU
\begin_inset LatexCommand \index{GNU}
\end_inset
zip
\begin_inset LatexCommand \index{zip}
\end_inset
compression program
\begin_inset LatexCommand \index{program}
\end_inset
and probably
\begin_inset LatexCommand \index{probably}
\end_inset
the most common
\begin_inset LatexCommand \index{common}
\end_inset
compression format
\begin_inset LatexCommand \index{format}
\end_inset
on UNIX-like
\begin_inset LatexCommand \index{UNIX-like}
\end_inset
operating systems.
\begin_inset LatexCommand \index{systems}
\end_inset
\begin_deeper
\layout Code
gzip your_tar_file.tar
\layout Standard
This will compress
\begin_inset LatexCommand \index{compress}
\end_inset
a tar
\begin_inset LatexCommand \index{tar}
\end_inset
archive
\begin_inset LatexCommand \index{archive}
\end_inset
with GNU
\begin_inset LatexCommand \index{GNU}
\end_inset
zip,
\begin_inset LatexCommand \index{zip}
\end_inset
usually with a .gz
\begin_inset LatexCommand \index{.gz}
\end_inset
extension.
Gzip
\begin_inset LatexCommand \index{Gzip}
\end_inset
can compress
\begin_inset LatexCommand \index{compress}
\end_inset
any type of file,
\begin_inset LatexCommand \index{file}
\end_inset
it doesn't have to be a tar
\begin_inset LatexCommand \index{tar}
\end_inset
archive.
\begin_inset LatexCommand \index{archive}
\end_inset
\layout Code
\series medium
gunzip your_file.gz
\series default
\layout Standard
This will decompress
\begin_inset LatexCommand \index{decompress}
\end_inset
a gzipped
\begin_inset LatexCommand \index{gzipped}
\end_inset
file, and leave the contents
\begin_inset LatexCommand \index{contents}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
\end_deeper
\layout Description
bzip2 bzip2
\begin_inset LatexCommand \index{bzip2}
\end_inset
is a newer
\begin_inset LatexCommand \index{newer}
\end_inset
compression program
\begin_inset LatexCommand \index{program}
\end_inset
which
\begin_inset LatexCommand \index{which}
\end_inset
offers superior
\begin_inset LatexCommand \index{superior}
\end_inset
compression to gzip
\begin_inset LatexCommand \index{gzip}
\end_inset
at the cost
\begin_inset LatexCommand \index{cost}
\end_inset
of more
\begin_inset LatexCommand \index{more}
\end_inset
processor
\begin_inset LatexCommand \index{processor}
\end_inset
time.
\begin_inset LatexCommand \index{time}
\end_inset
\begin_inset Note
collapsed true
\layout Standard
I guess that could change though\SpecialChar \ldots{}
\end_inset
\begin_deeper
\layout Code
\series medium
bzip2 your_tar_file.tar
\layout Standard
This will compress
\begin_inset LatexCommand \index{compress}
\end_inset
a tar
\begin_inset LatexCommand \index{tar}
\end_inset
archive
\begin_inset LatexCommand \index{archive}
\end_inset
with the bzip2
\begin_inset LatexCommand \index{bzip2}
\end_inset
compression program,
\begin_inset LatexCommand \index{program}
\end_inset
usually with a .bz
\begin_inset LatexCommand \index{.bz}
\end_inset
extension.
bzip2
\begin_inset LatexCommand \index{bzip2}
\end_inset
can compress
\begin_inset LatexCommand \index{compress}
\end_inset
any type of file,
\begin_inset LatexCommand \index{file}
\end_inset
it doesn't have to be a tar
\begin_inset LatexCommand \index{tar}
\end_inset
archive.
\begin_inset LatexCommand \index{archive}
\end_inset
\layout Code
\series medium
bunzip2 your_file.tar.bz2
\layout Standard
This will decompress
\begin_inset LatexCommand \index{decompress}
\end_inset
a file
\begin_inset LatexCommand \index{file}
\end_inset
compressed
\begin_inset LatexCommand \index{compressed}
\end_inset
by bzip2,
\begin_inset LatexCommand \index{bzip2}
\end_inset
and leave the contents
\begin_inset LatexCommand \index{contents}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
\series bold
\end_deeper
\layout Description
zipinfo
\begin_inset LatexCommand \index{zipinfo}
\end_inset
Use
\emph on
zipinfo
\emph default
to find
\begin_inset LatexCommand \index{find}
\end_inset
detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
about a zip
\begin_inset LatexCommand \index{zip}
\end_inset
archive (the ones usually generally used by ms-dos
\begin_inset LatexCommand \index{ms-dos}
\end_inset
and windows,
\begin_inset LatexCommand \index{windows}
\end_inset
for example
\begin_inset LatexCommand \index{example}
\end_inset
winzip).
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
zipinfo zip_file.zip
\end_deeper
\layout Description
zipgrep
\begin_inset LatexCommand \index{zipgrep}
\end_inset
Will run
\begin_inset LatexCommand \index{run}
\end_inset
\emph on
grep
\emph default
to look
\begin_inset LatexCommand \index{look}
\end_inset
for files
\begin_inset LatexCommand \index{files}
\end_inset
within a zip
\begin_inset LatexCommand \index{zip}
\end_inset
file (ms-dos style,
\begin_inset LatexCommand \index{style}
\end_inset
for example
\begin_inset LatexCommand \index{example}
\end_inset
winzip) without manually
\begin_inset LatexCommand \index{manually}
\end_inset
decompressing the file
\begin_inset LatexCommand \index{file}
\end_inset
first.
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
zipgrep pattern zip_file.zip
\end_deeper
\layout Description
bzip2recover
\begin_inset LatexCommand \index{bzip2recover}
\end_inset
Used to recover
\begin_inset LatexCommand \index{recover}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
from a damaged
\begin_inset LatexCommand \index{damaged}
\end_inset
bzip2 archive.
\begin_inset LatexCommand \index{archive}
\end_inset
It simply extracts out all the working
\begin_inset LatexCommand \index{working}
\end_inset
blocks
\begin_inset LatexCommand \index{blocks}
\end_inset
as there own bzip2
\begin_inset LatexCommand \index{bzip2}
\end_inset
archives,
\begin_inset LatexCommand \index{archives}
\end_inset
you can than use
\emph on
bzip2
\begin_inset LatexCommand \index{bzip2}
\end_inset
-t
\begin_inset LatexCommand \index{-t}
\end_inset
\emph default
on each file
\begin_inset LatexCommand \index{file}
\end_inset
to test
\begin_inset LatexCommand \index{test}
\end_inset
the integrity
\begin_inset LatexCommand \index{integrity}
\end_inset
of them and extract
\begin_inset LatexCommand \index{extract}
\end_inset
the working
\begin_inset LatexCommand \index{working}
\end_inset
files.
\layout Description
bzme
\begin_inset LatexCommand \index{bzme}
\end_inset
Will convert
\begin_inset LatexCommand \index{convert}
\end_inset
a file
\begin_inset LatexCommand \index{file}
\end_inset
that is zipped
\begin_inset LatexCommand \index{zipped}
\end_inset
or gzipped
\begin_inset LatexCommand \index{gzipped}
\end_inset
to a file
\begin_inset LatexCommand \index{file}
\end_inset
compressed
\begin_inset LatexCommand \index{compressed}
\end_inset
using
\emph on
bzip2
\emph default
.
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
bzme filename
\end_deeper
\layout SGML
\layout SGML
Tip
\layout SGML
\layout SGML
Both gzip and bzip2 supply tools to work within compressed files for example
listing the files within the archive, running
\emph on
less
\emph default
on them, using
\emph on
grep
\emph default
to find files within the archive et cetera.
\layout SGML
\layout SGML
\layout SGML
For gzip the commands are prefixed with z,
\emph on
zcat, zless, zgrep
\emph default
.
\layout SGML
\layout SGML
\layout SGML
For bzip2 the commands are prefixed with bz,
\emph on
bzcat, bzless, bzgrep
\emph default
.
\layout SGML
\layout SGML
\layout Chapter
Graphics tools (command line based)
\begin_inset LatexCommand \label{Graphics-tools}
\end_inset
\layout Standard
The graphics
\begin_inset LatexCommand \index{graphics}
\end_inset
tools chapter explains
\begin_inset LatexCommand \index{explains}
\end_inset
some image
\begin_inset LatexCommand \index{image}
\end_inset
programs
\begin_inset LatexCommand \index{programs}
\end_inset
that can be called from the command-line.
\begin_inset LatexCommand \index{command-line}
\end_inset
While I have found
\begin_inset LatexCommand \index{found}
\end_inset
image
\begin_inset LatexCommand \index{image}
\end_inset
programs
\begin_inset LatexCommand \index{programs}
\end_inset
that can be used from the command-line,
\begin_inset LatexCommand \index{command-line}
\end_inset
zgv
\begin_inset LatexCommand \index{zgv}
\end_inset
is the only one I've ever heard of, I did not find
\begin_inset LatexCommand \index{find}
\end_inset
them very useful.
All the tools
\begin_inset LatexCommand \index{tools}
\end_inset
listed
\begin_inset LatexCommand \index{listed}
\end_inset
use the X windowing
\begin_inset LatexCommand \index{windowing}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
to work
\begin_inset LatexCommand \index{work}
\end_inset
and simply run
\begin_inset LatexCommand \index{run}
\end_inset
from the command
\begin_inset LatexCommand \index{command}
\end_inset
line (so they can be scripted/automated if necessary).
\layout Description
\noindent
montage
\begin_inset LatexCommand \index{montage}
\end_inset
Creates a 'montage', an image
\begin_inset LatexCommand \index{image}
\end_inset
created of many other images,
\begin_inset LatexCommand \index{images}
\end_inset
arranged
\begin_inset LatexCommand \index{arranged}
\end_inset
in a random
\begin_inset LatexCommand \index{random}
\end_inset
fashion.
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
montage r34.jpg r32.jpg skylines* skyline_images.miff
\layout Standard
The above would create a
\begin_inset Quotes eld
\end_inset
montage
\begin_inset Quotes erd
\end_inset
of images
\begin_inset LatexCommand \index{images}
\end_inset
(it would tile
\begin_inset LatexCommand \index{tile}
\end_inset
a certain number
\begin_inset LatexCommand \index{number}
\end_inset
of images) into a composite
\begin_inset LatexCommand \index{composite}
\end_inset
image called
\begin_inset Quotes eld
\end_inset
skyline_images.miff
\begin_inset Quotes erd
\end_inset
, you could always use
\emph on
display
\begin_inset LatexCommand \index{display}
\end_inset
\emph default
to view
\begin_inset LatexCommand \index{view}
\end_inset
the image.
\begin_inset LatexCommand \index{image}
\end_inset
\layout SGML
\layout SGML
Note
\layout SGML
\layout SGML
Note that the images are converted to the same size (scaled) so they can
be tiled together.
\layout SGML
\layout SGML
\end_deeper
\layout Description
\noindent
convert To convert
\begin_inset LatexCommand \index{convert}
\end_inset
the file
\begin_inset LatexCommand \index{file}
\end_inset
format
\begin_inset LatexCommand \index{format}
\end_inset
of an image
\begin_inset LatexCommand \index{image}
\end_inset
to another image
\begin_inset LatexCommand \index{image}
\end_inset
format.
\emph on
convert
\emph default
is used to change
\begin_inset LatexCommand \index{change}
\end_inset
a files
\begin_inset LatexCommand \index{files}
\end_inset
format,
\begin_inset LatexCommand \index{format}
\end_inset
for example
\begin_inset LatexCommand \index{example}
\end_inset
from a jpeg
\begin_inset LatexCommand \index{jpeg}
\end_inset
to a bitmap
\begin_inset LatexCommand \index{bitmap}
\end_inset
or one of many other formats.
\begin_inset LatexCommand \index{formats}
\end_inset
\emph on
convert
\begin_inset LatexCommand \index{convert}
\end_inset
\emph default
can also manipulate
\begin_inset LatexCommand \index{manipulate}
\end_inset
the images
\begin_inset LatexCommand \index{images}
\end_inset
as well (see the man
\begin_inset LatexCommand \index{man}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
or the ImageMagick
\begin_inset LatexCommand \index{ImageMagick}
\end_inset
site).
\begin_deeper
\layout Standard
\noindent
Example
\begin_inset LatexCommand \index{Example}
\end_inset
from Jpeg
\begin_inset LatexCommand \index{Jpeg}
\end_inset
to PNG
\begin_inset LatexCommand \index{PNG}
\end_inset
format:
\layout Code
\noindent
convert JPEG: thisfile.jpg PNG: thisfile.png
\end_deeper
\layout Description
\noindent
import
\begin_inset LatexCommand \index{import}
\end_inset
Captures screen-shots
\begin_inset LatexCommand \index{screen-shots}
\end_inset
from the X server
\begin_inset LatexCommand \index{server}
\end_inset
and saves
\begin_inset LatexCommand \index{saves}
\end_inset
them to a file.
\begin_inset LatexCommand \index{file}
\end_inset
A screen-dump
\begin_inset LatexCommand \index{screen-dump}
\end_inset
of what X is doing.
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
import file_name
\end_deeper
\layout Description
display
\begin_inset LatexCommand \index{display}
\end_inset
\emph on
display
\emph default
is used to display
\begin_inset LatexCommand \index{display}
\end_inset
(output) images
\begin_inset LatexCommand \index{images}
\end_inset
on the screen.
\begin_inset LatexCommand \index{screen}
\end_inset
Once open
\begin_inset LatexCommand \index{open}
\end_inset
you are can also perform
\begin_inset LatexCommand \index{perform}
\end_inset
editing
\begin_inset LatexCommand \index{editing}
\end_inset
functions and are able
\begin_inset LatexCommand \index{able}
\end_inset
to read/write images.
\begin_inset LatexCommand \index{images}
\end_inset
It has various interesting options
\begin_inset LatexCommand \index{options}
\end_inset
such as the ability
\begin_inset LatexCommand \index{ability}
\end_inset
to display
\begin_inset LatexCommand \index{display}
\end_inset
images
\begin_inset LatexCommand \index{images}
\end_inset
as a slide
\begin_inset LatexCommand \index{slide}
\end_inset
show
\begin_inset LatexCommand \index{show}
\end_inset
and the ability
\begin_inset LatexCommand \index{ability}
\end_inset
to capture
\begin_inset LatexCommand \index{capture}
\end_inset
screenshots of a single window
\begin_inset LatexCommand \index{window}
\end_inset
on-screen.
\begin_inset LatexCommand \index{on-screen}
\end_inset
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax (for displaying an image):
\layout Code
display image_name
\layout Standard
To display
\begin_inset LatexCommand \index{display}
\end_inset
a slide
\begin_inset LatexCommand \index{slide}
\end_inset
show
\begin_inset LatexCommand \index{show}
\end_inset
of images, open
\begin_inset LatexCommand \index{open}
\end_inset
the images
\begin_inset LatexCommand \index{images}
\end_inset
you want possibly
\begin_inset LatexCommand \index{possibly}
\end_inset
using a wild
\begin_inset LatexCommand \index{wild}
\end_inset
card, for example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
display *.jpg
\layout Standard
And then click
\begin_inset LatexCommand \index{click}
\end_inset
on the image
\begin_inset LatexCommand \index{image}
\end_inset
to bring up the menu
\begin_inset LatexCommand \index{menu}
\end_inset
and then look
\begin_inset LatexCommand \index{look}
\end_inset
under the miscellaneous
\begin_inset LatexCommand \index{miscellaneous}
\end_inset
menu
\begin_inset LatexCommand \index{menu}
\end_inset
for the slide
\begin_inset LatexCommand \index{slide}
\end_inset
show
\begin_inset LatexCommand \index{show}
\end_inset
option.
\layout SGML
\layout SGML
Speed Warning
\layout SGML
\layout SGML
Be careful when opening multiple large sized images (especially on a slow
machine) and putting the slide show on a small delay between image changes.
Your processor will be overloaded and it will take a significant amount
of time to be able to close ImageMagick.
\layout SGML
\layout SGML
\end_deeper
\layout Description
identify Will identify
\begin_inset LatexCommand \index{identify}
\end_inset
the type of image
\begin_inset LatexCommand \index{image}
\end_inset
as well as it's size,
\begin_inset LatexCommand \index{size}
\end_inset
colour
\begin_inset LatexCommand \index{colour}
\end_inset
depth and various other information.
\begin_inset LatexCommand \index{information}
\end_inset
Use the
\emph on
-verbose
\begin_inset LatexCommand \index{-verbose}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to show
\begin_inset LatexCommand \index{show}
\end_inset
detailed
\begin_inset LatexCommand \index{detailed}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on the particular
\begin_inset LatexCommand \index{particular}
\end_inset
file(s).
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
identify image_name
\end_deeper
\layout Description
mogrify
\begin_inset LatexCommand \index{mogrify}
\end_inset
\emph on
mogrify
\emph default
is another ImageMagick
\begin_inset LatexCommand \index{ImageMagick}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
which is used to transform
\begin_inset LatexCommand \index{transform}
\end_inset
images
\begin_inset LatexCommand \index{images}
\end_inset
in a number
\begin_inset LatexCommand \index{number}
\end_inset
of different
\begin_inset LatexCommand \index{different}
\end_inset
ways, including
\begin_inset LatexCommand \index{including}
\end_inset
scaling,
\begin_inset LatexCommand \index{scaling}
\end_inset
rotation
\begin_inset LatexCommand \index{rotation}
\end_inset
and various other effects.
\begin_inset LatexCommand \index{effects}
\end_inset
This command
\begin_inset LatexCommand \index{command}
\end_inset
can work
\begin_inset LatexCommand \index{work}
\end_inset
on a single file
\begin_inset LatexCommand \index{file}
\end_inset
or in batch.
\begin_inset LatexCommand \index{batch}
\end_inset
\begin_deeper
\layout Standard
For example,
\begin_inset LatexCommand \index{example}
\end_inset
to convert
\begin_inset LatexCommand \index{convert}
\end_inset
a large number
\begin_inset LatexCommand \index{number}
\end_inset
of tiff
\begin_inset LatexCommand \index{tiff}
\end_inset
files
\begin_inset LatexCommand \index{files}
\end_inset
to jpeg
\begin_inset LatexCommand \index{jpeg}
\end_inset
files you could type:
\layout Code
mogrify -format jpeg *.tiff
\layout Standard
This command
\begin_inset LatexCommand \index{command}
\end_inset
has the power
\begin_inset LatexCommand \index{power}
\end_inset
to do a number
\begin_inset LatexCommand \index{number}
\end_inset
of things in batch
\begin_inset LatexCommand \index{batch}
\end_inset
including making thumbnails
\begin_inset LatexCommand \index{thumbnails}
\end_inset
of sets
\begin_inset LatexCommand \index{sets}
\end_inset
of images.
\begin_inset LatexCommand \index{images}
\end_inset
\layout Standard
For this you could type:
\begin_inset Foot
collapsed false
\layout Standard
This example has come been used from (unedited)
\begin_inset Quotes eld
\end_inset
CLI for noobies: import, display, mogrify
\begin_inset Quotes erd
\end_inset
, see [16] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
\layout Code
mogrify -geometry 120x120 *.jpg
\end_deeper
\layout Description
showrgb
\begin_inset LatexCommand \index{showrgb}
\end_inset
\emph on
showrgb
\emph default
is used to uncompile
\begin_inset LatexCommand \index{uncompile}
\end_inset
an rgb
\begin_inset LatexCommand \index{rgb}
\end_inset
colour-name database.
\begin_inset LatexCommand \index{database}
\end_inset
The default
\begin_inset LatexCommand \index{default}
\end_inset
is the one that X was built
\begin_inset LatexCommand \index{built}
\end_inset
with.
This database
\begin_inset LatexCommand \index{database}
\end_inset
can be used to find
\begin_inset LatexCommand \index{find}
\end_inset
the correct
\begin_inset LatexCommand \index{correct}
\end_inset
colour
\begin_inset LatexCommand \index{colour}
\end_inset
combination for a particular
\begin_inset LatexCommand \index{particular}
\end_inset
colour
\begin_inset LatexCommand \index{colour}
\end_inset
(well it can be used as a rough
\begin_inset LatexCommand \index{rough}
\end_inset
guide
\begin_inset LatexCommand \index{guide}
\end_inset
anyway).
\begin_deeper
\layout Standard
To list
\begin_inset LatexCommand \index{list}
\end_inset
the colours
\begin_inset LatexCommand \index{colours}
\end_inset
from the X database,
\begin_inset LatexCommand \index{database}
\end_inset
simply type:
\layout Code
showrgb
\end_deeper
\layout SGML
\layout SGML
Please note:
\layout SGML
\layout SGML
All tools listed, excluding
\emph on
showrgb
\emph default
are part of the ImageMagick package.
Type
\emph on
man ImageMagick
\emph default
for a full list of available commands.
Or see the ImageMagick site
\begin_inset LatexCommand \url[ImageMagick]{https://www.imagemagick.org}
\end_inset
for further information.
\layout SGML
\layout SGML
\layout Chapter
\noindent
Working with MS-DOS files
\begin_inset LatexCommand \label{Working-with-MS-DOS}
\end_inset
\layout Standard
\noindent
Use the mtools
\begin_inset LatexCommand \index{mtools}
\end_inset
programs
\begin_inset LatexCommand \index{programs}
\end_inset
to work
\begin_inset LatexCommand \index{work}
\end_inset
with MS-DOS
\begin_inset LatexCommand \index{MS-DOS}
\end_inset
based files,
\begin_inset LatexCommand \index{files}
\end_inset
execute
\begin_inset LatexCommand \index{execute}
\end_inset
\emph on
mtools
\emph default
for a full
\begin_inset LatexCommand \index{full}
\end_inset
listing
\begin_inset LatexCommand \index{listing}
\end_inset
of available
\begin_inset LatexCommand \index{available}
\end_inset
m* tools.
\begin_inset LatexCommand \index{tools}
\end_inset
There are a lot of files
\begin_inset LatexCommand \index{files}
\end_inset
within the mtools
\begin_inset LatexCommand \index{mtools}
\end_inset
package
\begin_inset LatexCommand \index{package}
\end_inset
for working
\begin_inset LatexCommand \index{working}
\end_inset
with MS-DOS
\begin_inset LatexCommand \index{MS-DOS}
\end_inset
disks,
\begin_inset LatexCommand \index{disks}
\end_inset
also try
\begin_inset LatexCommand \index{try}
\end_inset
the info
\begin_inset LatexCommand \index{info}
\end_inset
documentation
\begin_inset LatexCommand \index{documentation}
\end_inset
of mtools
\begin_inset LatexCommand \index{mtools}
\end_inset
for more
\begin_inset LatexCommand \index{more}
\end_inset
details.
\begin_inset LatexCommand \index{details}
\end_inset
\layout SGML
\layout SGML
The use of slashes
\layout SGML
\layout SGML
Note that with mtools commands you can use the slashes on the a: part either
way (ie.
backslash (windows-style) or forward slash (UNIX system style)).
\layout SGML
\layout SGML
\layout Description
\noindent
mformat
\begin_inset LatexCommand \index{mformat}
\end_inset
Formats
\begin_inset LatexCommand \index{Formats}
\end_inset
an unmounted
\begin_inset LatexCommand \index{unmounted}
\end_inset
disk as an ms-dos
\begin_inset LatexCommand \index{ms-dos}
\end_inset
floppy disk.
\begin_inset LatexCommand \index{disk}
\end_inset
Usage
\begin_inset LatexCommand \index{Usage}
\end_inset
is similar
\begin_inset LatexCommand \index{similar}
\end_inset
to the ms-dos
\begin_inset LatexCommand \index{ms-dos}
\end_inset
format
\begin_inset LatexCommand \index{format}
\end_inset
utility,
\begin_inset LatexCommand \index{utility}
\end_inset
to format
\begin_inset LatexCommand \index{format}
\end_inset
the first floppy
\begin_inset LatexCommand \index{floppy}
\end_inset
disk
\begin_inset LatexCommand \index{disk}
\end_inset
you can type:
\begin_deeper
\layout Code
mformat a:
\end_deeper
\layout Description
\noindent
mcopy
\begin_inset LatexCommand \index{mcopy}
\end_inset
Copies files
\begin_inset LatexCommand \index{files}
\end_inset
from an ms-dos
\begin_inset LatexCommand \index{ms-dos}
\end_inset
disk
\begin_inset LatexCommand \index{disk}
\end_inset
when it's not mounted.
\begin_inset LatexCommand \index{mounted}
\end_inset
Similar to the ms-dos
\begin_inset LatexCommand \index{ms-dos}
\end_inset
copy
\begin_inset LatexCommand \index{copy}
\end_inset
command except it's more
\begin_inset LatexCommand \index{more}
\end_inset
advanced.
\begin_inset LatexCommand \index{advanced}
\end_inset
\begin_deeper
\layout Standard
\noindent
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
mcopy a:/file_or_files /destination/directory
\end_deeper
\layout Description
\noindent
mmount
\begin_inset LatexCommand \index{mmount}
\end_inset
Mount an ms-dos
\begin_inset LatexCommand \index{ms-dos}
\end_inset
disk,
\begin_inset LatexCommand \index{disk}
\end_inset
without using the normal
\begin_inset LatexCommand \index{normal}
\end_inset
UNIX system
\begin_inset LatexCommand \index{system}
\end_inset
mount.
\begin_deeper
\layout Standard
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
mmount a: /mnt/floppy
\layout Standard
This will mount
\begin_inset LatexCommand \index{mount}
\end_inset
the floppy
\begin_inset LatexCommand \index{floppy}
\end_inset
under /mnt/floppy (this option
\begin_inset LatexCommand \index{option}
\end_inset
may or may not be necessary, it depends on your /etc/fstab setup).
\end_deeper
\layout Description
mbadblocks
\begin_inset LatexCommand \index{mbadblocks}
\end_inset
Scans
\begin_inset LatexCommand \index{Scans}
\end_inset
an ms-dos
\begin_inset LatexCommand \index{ms-dos}
\end_inset
(fat formatted
\begin_inset LatexCommand \index{formatted}
\end_inset
disk) for bad blocks,
\begin_inset LatexCommand \index{blocks}
\end_inset
it marks
\begin_inset LatexCommand \index{marks}
\end_inset
any unused
\begin_inset LatexCommand \index{unused}
\end_inset
bad blocks
\begin_inset LatexCommand \index{blocks}
\end_inset
as
\begin_inset Quotes eld
\end_inset
bad
\begin_inset Quotes erd
\end_inset
so they won't be used.
\begin_deeper
\layout Standard
Example:
\layout Code
mbadblocks a:
\end_deeper
\layout Description
dosfsck
\begin_inset LatexCommand \index{dosfsck}
\end_inset
This program
\begin_inset LatexCommand \index{program}
\end_inset
is used to check
\begin_inset LatexCommand \index{check}
\end_inset
and repair
\begin_inset LatexCommand \index{repair}
\end_inset
ms-dos based filesystems.
\begin_inset LatexCommand \index{filesystems}
\end_inset
Use the
\emph on
-a
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to automatically
\begin_inset LatexCommand \index{automatically}
\end_inset
repair
\begin_inset LatexCommand \index{repair}
\end_inset
the filesystem
\begin_inset LatexCommand \index{filesystem}
\end_inset
(ie don't ask the user
\begin_inset LatexCommand \index{user}
\end_inset
questions), the
\emph on
-t
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to mark
\begin_inset LatexCommand \index{mark}
\end_inset
un-readable
\begin_inset LatexCommand \index{un-readable}
\end_inset
clusters
\begin_inset LatexCommand \index{clusters}
\end_inset
as bad and the
\emph on
-v
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to be more
\begin_inset LatexCommand \index{more}
\end_inset
verbose
\begin_inset LatexCommand \index{verbose}
\end_inset
(print more
\begin_inset LatexCommand \index{more}
\end_inset
information).
\begin_deeper
\layout Standard
Example:
\layout Code
dosfsck -at /dev/fd0
\layout Standard
This would check
\begin_inset LatexCommand \index{check}
\end_inset
your floppy
\begin_inset LatexCommand \index{floppy}
\end_inset
disk
\begin_inset LatexCommand \index{disk}
\end_inset
for any errors
\begin_inset LatexCommand \index{errors}
\end_inset
(and bad sectors) and repair
\begin_inset LatexCommand \index{repair}
\end_inset
them automatically.
\begin_inset LatexCommand \index{automatically}
\end_inset
\end_deeper
\layout Chapter
Scheduling Commands to run in the background
\begin_inset LatexCommand \label{Scheduling}
\end_inset
\layout Standard
\noindent
There are two main tools
\begin_inset LatexCommand \index{tools}
\end_inset
used to perform
\begin_inset LatexCommand \index{perform}
\end_inset
scheduled
\begin_inset LatexCommand \index{scheduled}
\end_inset
tasks,
\emph on
at
\emph default
and
\emph on
cron
\emph default
.
You may also like to try
\begin_inset LatexCommand \index{try}
\end_inset
\begin_inset LatexCommand \url[anacron]{https://anacron.sourceforge.net}
\end_inset
if your computer
\begin_inset LatexCommand \index{computer}
\end_inset
does not run
\begin_inset LatexCommand \index{run}
\end_inset
continuously, as cron
\begin_inset LatexCommand \index{cron}
\end_inset
will only work
\begin_inset LatexCommand \index{work}
\end_inset
if your computer
\begin_inset LatexCommand \index{computer}
\end_inset
is left
\begin_inset LatexCommand \index{left}
\end_inset
on (anacron can catch
\begin_inset LatexCommand \index{catch}
\end_inset
up with the scheduled
\begin_inset LatexCommand \index{scheduled}
\end_inset
tasks the next time the computer is on\SpecialChar \ldots{}
).
\layout Description
\noindent
at
\begin_inset LatexCommand \index{at}
\end_inset
'at' executes a command
\begin_inset LatexCommand \index{command}
\end_inset
once on a particular
\begin_inset LatexCommand \index{particular}
\end_inset
day,
\begin_inset LatexCommand \index{day}
\end_inset
at a particular
\begin_inset LatexCommand \index{particular}
\end_inset
time.
\begin_inset LatexCommand \index{time}
\end_inset
\emph on
at
\emph default
will add
\begin_inset LatexCommand \index{add}
\end_inset
a particular
\begin_inset LatexCommand \index{particular}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
to be executed.
\begin_deeper
\layout Standard
\noindent
Examples:
\layout Code
at 21:30
\layout Standard
You then type the commands
\begin_inset LatexCommand \index{commands}
\end_inset
you want executed then press
\begin_inset LatexCommand \index{press}
\end_inset
the end-of-file
\begin_inset LatexCommand \index{end-of-file}
\end_inset
character
\begin_inset LatexCommand \index{character}
\end_inset
(normally CTRL-D).
Also try:
\begin_inset LatexCommand \index{try}
\end_inset
\layout Code
at now + time
\layout Standard
This will run
\begin_inset LatexCommand \index{run}
\end_inset
at at the current
\begin_inset LatexCommand \index{current}
\end_inset
time
\begin_inset LatexCommand \index{time}
\end_inset
+ the hours/mins/seconds you specify
\begin_inset LatexCommand \index{specify}
\end_inset
(use
\emph on
at now + 1 hour
\begin_inset LatexCommand \index{hour}
\end_inset
\emph default
to have command(s) run in 1 hour from now\SpecialChar \ldots{}
)
\layout Standard
You can also use the
\emph on
-f
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to have at execute
\begin_inset LatexCommand \index{execute}
\end_inset
a particular
\begin_inset LatexCommand \index{particular}
\end_inset
file (a shell
\begin_inset LatexCommand \index{shell}
\end_inset
script).
\layout Code
at -f shell_script now + 1 hour
\layout Standard
This would run
\begin_inset LatexCommand \index{run}
\end_inset
the shell
\begin_inset LatexCommand \index{shell}
\end_inset
script 1 hour
\begin_inset LatexCommand \index{hour}
\end_inset
from now.
\end_deeper
\layout Description
atq
\begin_inset LatexCommand \index{atq}
\end_inset
Will list
\begin_inset LatexCommand \index{list}
\end_inset
jobs currently in queue
\begin_inset LatexCommand \index{queue}
\end_inset
for the user
\begin_inset LatexCommand \index{user}
\end_inset
who executed it, if root
\begin_inset LatexCommand \index{root}
\end_inset
executes at it will list
\begin_inset LatexCommand \index{list}
\end_inset
all jobs
\begin_inset LatexCommand \index{jobs}
\end_inset
in queue
\begin_inset LatexCommand \index{queue}
\end_inset
for the at daemon.
\begin_inset LatexCommand \index{daemon}
\end_inset
Doesn't need or take
\begin_inset LatexCommand \index{take}
\end_inset
any options.
\begin_inset LatexCommand \index{options}
\end_inset
\layout Description
atrm
\begin_inset LatexCommand \index{atrm}
\end_inset
Will remove
\begin_inset LatexCommand \index{remove}
\end_inset
a job
\begin_inset LatexCommand \index{job}
\end_inset
from the 'at' queue.
\begin_inset LatexCommand \index{queue}
\end_inset
\begin_deeper
\layout Standard
Command
\begin_inset LatexCommand \index{Command}
\end_inset
syntax:
\layout Code
atrm job_no
\layout Standard
Will delete
\begin_inset LatexCommand \index{delete}
\end_inset
the job
\begin_inset LatexCommand \index{job}
\end_inset
\begin_inset Quotes eld
\end_inset
job_no
\begin_inset Quotes erd
\end_inset
(use
\emph on
atq
\emph default
to find
\begin_inset LatexCommand \index{find}
\end_inset
out the number
\begin_inset LatexCommand \index{number}
\end_inset
of the job)
\end_deeper
\layout Description
\noindent
cron
\emph on
cron
\begin_inset LatexCommand \index{cron}
\end_inset
\emph default
can be used to schedule
\begin_inset LatexCommand \index{schedule}
\end_inset
a particular
\begin_inset LatexCommand \index{particular}
\end_inset
function
\begin_inset LatexCommand \index{function}
\end_inset
to occur
\begin_inset LatexCommand \index{occur}
\end_inset
every minute,
\begin_inset LatexCommand \index{minute}
\end_inset
hour,
\begin_inset LatexCommand \index{hour}
\end_inset
day,
\begin_inset LatexCommand \index{day}
\end_inset
week,
\begin_inset LatexCommand \index{week}
\end_inset
or month.
\begin_inset LatexCommand \index{month}
\end_inset
\begin_deeper
\layout Standard
\noindent
It's normal
\begin_inset LatexCommand \index{normal}
\end_inset
to use the crontab
\begin_inset LatexCommand \index{crontab}
\end_inset
to perform
\begin_inset LatexCommand \index{perform}
\end_inset
the editing
\begin_inset LatexCommand \index{editing}
\end_inset
functions as this automates
\begin_inset LatexCommand \index{automates}
\end_inset
the process
\begin_inset LatexCommand \index{process}
\end_inset
for the cron
\begin_inset LatexCommand \index{cron}
\end_inset
daemon
\begin_inset LatexCommand \index{daemon}
\end_inset
and makes it easier for normal
\begin_inset LatexCommand \index{normal}
\end_inset
users
\begin_inset LatexCommand \index{users}
\end_inset
to use cron.
\begin_inset LatexCommand \index{cron}
\end_inset
\layout SGML
\layout SGML
Anacron
\layout SGML
\emph on
anacron
\emph default
is another tool designed for systems which are not always on, such as home
computers
\layout SGML
While
\emph on
cron
\emph default
will not run if the computer is off,
\emph on
anacron
\emph default
will simply run the command when the computer is next on (it catches up
with things).
\layout SGML
\layout Standard
\begin_inset Note
collapsed false
\layout Standard
if thats incorrect please email me and explain how it works\SpecialChar \ldots{}
\end_inset
\end_deeper
\layout Description
crontab
\begin_inset LatexCommand \index{crontab}
\end_inset
\emph on
crontab
\emph default
is used to edit,
\begin_inset LatexCommand \index{edit}
\end_inset
read
\begin_inset LatexCommand \index{read}
\end_inset
and remove
\begin_inset LatexCommand \index{remove}
\end_inset
the files
\begin_inset LatexCommand \index{files}
\end_inset
which the cron
\begin_inset LatexCommand \index{cron}
\end_inset
daemon
\begin_inset LatexCommand \index{daemon}
\end_inset
reads.
\begin_inset LatexCommand \index{reads}
\end_inset
\begin_deeper
\layout Standard
Options
\begin_inset LatexCommand \index{Options}
\end_inset
for crontab
\begin_inset LatexCommand \index{crontab}
\end_inset
(use
\emph on
crontab
\begin_inset LatexCommand \index{crontab}
\end_inset
-option(s)
\emph default
):
\layout Itemize
\emph on
-e
\emph default
--- to edit
\begin_inset LatexCommand \index{edit}
\end_inset
the file.
\begin_inset LatexCommand \index{file}
\end_inset
\layout Itemize
\emph on
-l
\emph default
--- to list
\begin_inset LatexCommand \index{list}
\end_inset
the contents
\begin_inset LatexCommand \index{contents}
\end_inset
of the file.
\begin_inset LatexCommand \index{file}
\end_inset
\layout Itemize
\emph on
-u
\begin_inset LatexCommand \index{-u}
\end_inset
username
\emph default
--- use the
\emph on
-u
\emph default
with a username
\begin_inset LatexCommand \index{username}
\end_inset
argument
\begin_inset LatexCommand \index{argument}
\end_inset
to work
\begin_inset LatexCommand \index{work}
\end_inset
with another users
\begin_inset LatexCommand \index{users}
\end_inset
crontab
\begin_inset LatexCommand \index{crontab}
\end_inset
file.
\layout Standard
When using
\emph on
crontab
\begin_inset LatexCommand \index{crontab}
\end_inset
-e
\begin_inset LatexCommand \index{-e}
\end_inset
\emph default
you have a number
\begin_inset LatexCommand \index{number}
\end_inset
of fields
\begin_inset LatexCommand \index{fields}
\end_inset
(6) what they mean
\begin_inset LatexCommand \index{mean}
\end_inset
is listed
\begin_inset LatexCommand \index{listed}
\end_inset
below:
\layout Standard
\begin_inset Tabular
\begin_inset Text
\layout Standard
Field
\end_inset
|
\begin_inset Text
\layout Standard
Allowed Values
\end_inset
|
\begin_inset Text
\layout Standard
minute
\end_inset
|
\begin_inset Text
\layout Standard
0-59
\end_inset
|
\begin_inset Text
\layout Standard
hour
\end_inset
|
\begin_inset Text
\layout Standard
0-23
\end_inset
|
\begin_inset Text
\layout Standard
day of month
\end_inset
|
\begin_inset Text
\layout Standard
1-31
\end_inset
|
\begin_inset Text
\layout Standard
month
\end_inset
|
\begin_inset Text
\layout Standard
1-12 (or names, see below)
\end_inset
|
\begin_inset Text
\layout Standard
day of week
\end_inset
|
\begin_inset Text
\layout Standard
0-7 (0 or 7 is Sun, or use three letter names)
\end_inset
|
\end_inset
\layout Standard
There are also a number
\begin_inset LatexCommand \index{number}
\end_inset
of shortcut
\begin_inset LatexCommand \index{shortcut}
\end_inset
methods for common
\begin_inset LatexCommand \index{common}
\end_inset
tasks, including:
\begin_inset LatexCommand \index{including}
\end_inset
\begin_inset Foot
collapsed false
\layout Standard
This information has come from (without editing) a post on the LinuxChix
techtalk mailing list, please see [16] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
\layout Itemize
\emph on
@reboot
\emph default
--- run
\begin_inset LatexCommand \index{run}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
at reboot
\begin_inset LatexCommand \index{reboot}
\end_inset
\layout Itemize
\emph on
@yearly
\emph default
--- same as 0 0 1 1 *
\layout Itemize
\emph on
@annually
\emph default
--- same as @yearly
\layout Itemize
\emph on
@monthly
\emph default
--- same as 0 0 1 * *
\layout Itemize
\emph on
@weekly
\emph default
--- same as 0 0 * * 0
\layout Itemize
\emph on
@daily
\emph default
--- same as 0 0 * * *
\layout Itemize
\emph on
@midnight
\emph default
--- same as @daily
\layout Itemize
\emph on
@hourly
\emph default
--- same as 0 * * * *
\layout Standard
\begin_inset Foot
collapsed false
\layout Standard
This information comes from the cron manual page with small additions (no
changes to original content), refer to [13] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
\layout Standard
Note that * (asterisk) is used to mean
\begin_inset LatexCommand \index{mean}
\end_inset
anything (similar to the wildcard).
For example
\begin_inset LatexCommand \index{example}
\end_inset
if you leave the day
\begin_inset LatexCommand \index{day}
\end_inset
part (the 5th place) with an asterisk
\begin_inset LatexCommand \index{asterisk}
\end_inset
it would mean
\begin_inset LatexCommand \index{mean}
\end_inset
everyday.
\begin_inset LatexCommand \index{everyday}
\end_inset
\layout Standard
Lists
\begin_inset LatexCommand \index{Lists}
\end_inset
are allowed.
\begin_inset LatexCommand \index{allowed}
\end_inset
A list
\begin_inset LatexCommand \index{list}
\end_inset
is a set
\begin_inset LatexCommand \index{set}
\end_inset
of numbers
\begin_inset LatexCommand \index{numbers}
\end_inset
(or ranges) separated
\begin_inset LatexCommand \index{separated}
\end_inset
by commas.
\begin_inset LatexCommand \index{commas}
\end_inset
Examples:
\begin_inset LatexCommand \index{Examples}
\end_inset
``1,2,5,9'', ``0-4,8-12
\begin_inset Quotes erd
\end_inset
.
\layout Standard
Step
\begin_inset LatexCommand \index{Step}
\end_inset
values
\begin_inset LatexCommand \index{values}
\end_inset
can be used in conjunction
\begin_inset LatexCommand \index{conjunction}
\end_inset
with ranges.
\begin_inset LatexCommand \index{ranges}
\end_inset
Following
\begin_inset LatexCommand \index{Following}
\end_inset
a range
\begin_inset LatexCommand \index{range}
\end_inset
with ``/'' specifies
\begin_inset LatexCommand \index{specifies}
\end_inset
skips of the number's value
\begin_inset LatexCommand \index{value}
\end_inset
through the range.
\begin_inset LatexCommand \index{range}
\end_inset
For example,
\begin_inset LatexCommand \index{example}
\end_inset
``0-23/2'' can be used in the hours
\begin_inset LatexCommand \index{hours}
\end_inset
field
\begin_inset LatexCommand \index{field}
\end_inset
to specify
\begin_inset LatexCommand \index{specify}
\end_inset
command
\begin_inset LatexCommand \index{command}
\end_inset
execution
\begin_inset LatexCommand \index{execution}
\end_inset
every other hour
\begin_inset LatexCommand \index{hour}
\end_inset
(the alternative
\begin_inset LatexCommand \index{alternative}
\end_inset
in the V7
\begin_inset LatexCommand \index{V7}
\end_inset
standard is ``0,2,4,6,8,10,12,14,16,18,20,22'').
Steps
\begin_inset LatexCommand \index{Steps}
\end_inset
are also permitted
\begin_inset LatexCommand \index{permitted}
\end_inset
after an asterisk,
\begin_inset LatexCommand \index{asterisk}
\end_inset
so if you want to say ``every two hours'', just use ``*/2''.
\layout Standard
When writing
\begin_inset LatexCommand \index{writing}
\end_inset
a crontab
\begin_inset LatexCommand \index{crontab}
\end_inset
entry
\begin_inset LatexCommand \index{entry}
\end_inset
you simply type in six
\begin_inset LatexCommand \index{six}
\end_inset
fields separated
\begin_inset LatexCommand \index{separated}
\end_inset
by spaces,
\begin_inset LatexCommand \index{spaces}
\end_inset
the first five
\begin_inset LatexCommand \index{five}
\end_inset
are those listed
\begin_inset LatexCommand \index{listed}
\end_inset
in the table
\begin_inset LatexCommand \index{table}
\end_inset
(using numbers
\begin_inset LatexCommand \index{numbers}
\end_inset
or letters
\begin_inset LatexCommand \index{letters}
\end_inset
and numbers
\begin_inset LatexCommand \index{numbers}
\end_inset
as appropriate), the 6th field
\begin_inset LatexCommand \index{field}
\end_inset
is the command
\begin_inset LatexCommand \index{command}
\end_inset
to be executed and any options,
\begin_inset LatexCommand \index{options}
\end_inset
cron
\begin_inset LatexCommand \index{cron}
\end_inset
will read
\begin_inset LatexCommand \index{read}
\end_inset
everything
\begin_inset LatexCommand \index{everything}
\end_inset
up until
\begin_inset LatexCommand \index{until}
\end_inset
the newline.
\begin_inset LatexCommand \index{newline}
\end_inset
\layout Standard
Example:
\layout Code
5 4 * * sun echo "run at 5 after 4 every sunday"
\layout Standard
This would run
\begin_inset LatexCommand \index{run}
\end_inset
the echo
\begin_inset LatexCommand \index{echo}
\end_inset
command with the string
\begin_inset LatexCommand \index{string}
\end_inset
shown at 4:05 every Sunday.
\begin_inset LatexCommand \index{Sunday}
\end_inset
\end_deeper
\layout Standard
\noindent
\begin_inset Note
collapsed false
\layout Standard
I really have never used cron\SpecialChar \ldots{}
and haven't used
\emph on
at
\emph default
that much either, does anyone else have any suggestions?
\layout Standard
I know anacron exists but I know nothing about it.
\end_inset
\layout Chapter
Miscellaneous
\begin_inset LatexCommand \label{Miscellaneous}
\end_inset
\layout Standard
The miscellaneous
\begin_inset LatexCommand \index{miscellaneous}
\end_inset
chapter contains commands
\begin_inset LatexCommand \index{commands}
\end_inset
that don't really
\begin_inset LatexCommand \index{really}
\end_inset
fit into the other sections
\begin_inset LatexCommand \index{sections}
\end_inset
of this guide.
\begin_inset LatexCommand \index{guide}
\end_inset
\layout Description
\noindent
renaming\SpecialChar ~
extensions
\begin_inset LatexCommand \index{extensions}
\end_inset
To rename
\begin_inset LatexCommand \index{rename}
\end_inset
all of the files
\begin_inset LatexCommand \index{files}
\end_inset
in the current
\begin_inset LatexCommand \index{current}
\end_inset
directory
\begin_inset LatexCommand \index{directory}
\end_inset
with a '.htm' extension
\begin_inset LatexCommand \index{extension}
\end_inset
to '.html', type:
\begin_deeper
\layout Code
\noindent
\series bold
$
\series default
chcase -x 's/htm/html/' '*.htm'
\layout Standard
You can get a copy
\begin_inset LatexCommand \index{copy}
\end_inset
of
\emph on
the chcase
\begin_inset LatexCommand \index{chcase}
\end_inset
\emph default
perl
\begin_inset LatexCommand \index{perl}
\end_inset
script
\emph on
\begin_inset LatexCommand \url[here.]{https://www.blemished.net/chcase.html}
\end_inset
\layout Standard
For more
\begin_inset LatexCommand \index{more}
\end_inset
complex
\begin_inset LatexCommand \index{complex}
\end_inset
renaming
\begin_inset LatexCommand \index{renaming}
\end_inset
you should read
\begin_inset LatexCommand \index{read}
\end_inset
\begin_inset LatexCommand \ref{mass-rename}
\end_inset
\end_deeper
\layout Description
\noindent
rel
\begin_inset Foot
collapsed true
\layout Standard
This information information comes from the Linux Cookbook (without editing).
See [3] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\end_inset
Use rel
\begin_inset LatexCommand \index{rel}
\end_inset
to analyze
\begin_inset LatexCommand \index{analyze}
\end_inset
text files
\begin_inset LatexCommand \index{files}
\end_inset
for relevance
\begin_inset LatexCommand \index{relevance}
\end_inset
to a given set
\begin_inset LatexCommand \index{set}
\end_inset
of keywords.
\begin_inset LatexCommand \index{keywords}
\end_inset
It outputs
\begin_inset LatexCommand \index{outputs}
\end_inset
the names of those files
\begin_inset LatexCommand \index{files}
\end_inset
that are relevant
\begin_inset LatexCommand \index{relevant}
\end_inset
to the given keywords,
\begin_inset LatexCommand \index{keywords}
\end_inset
ranked
\begin_inset LatexCommand \index{ranked}
\end_inset
in order
\begin_inset LatexCommand \index{order}
\end_inset
of relevance;
\begin_inset LatexCommand \index{relevance}
\end_inset
if a file
\begin_inset LatexCommand \index{file}
\end_inset
does not meet
\begin_inset LatexCommand \index{meet}
\end_inset
the criteria,
\begin_inset LatexCommand \index{criteria}
\end_inset
it is not outputted in the relevance
\begin_inset LatexCommand \index{relevance}
\end_inset
listing.
\layout Description
units\SpecialChar ~
man\SpecialChar ~
page
\begin_inset LatexCommand \index{page}
\end_inset
There is a man
\begin_inset LatexCommand \index{man}
\end_inset
page, part
\begin_inset LatexCommand \index{part}
\end_inset
of the Linux
\begin_inset LatexCommand \index{Linux}
\end_inset
Programmers
\begin_inset LatexCommand \index{Programmers}
\end_inset
Manual called
\begin_inset Quotes eld
\end_inset
units
\begin_inset Quotes erd
\end_inset
.
It displays various information
\begin_inset LatexCommand \index{information}
\end_inset
on the various scientific
\begin_inset LatexCommand \index{scientific}
\end_inset
measurements
\begin_inset LatexCommand \index{measurements}
\end_inset
(such as mega,
\begin_inset LatexCommand \index{mega}
\end_inset
giga
\begin_inset LatexCommand \index{giga}
\end_inset
et cetera).
This manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
also has a short
\begin_inset LatexCommand \index{short}
\end_inset
discussion about the argument
\begin_inset LatexCommand \index{argument}
\end_inset
over which
\begin_inset LatexCommand \index{which}
\end_inset
standard
\begin_inset LatexCommand \index{standard}
\end_inset
should be used to measure
\begin_inset LatexCommand \index{measure}
\end_inset
data (ie.
the kibibyte
\begin_inset LatexCommand \index{kibibyte}
\end_inset
vs kilobyte).
\begin_deeper
\layout Standard
To access
\begin_inset LatexCommand \index{access}
\end_inset
this man
\begin_inset LatexCommand \index{man}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
type:
\layout Code
man 7 units
\end_deeper
\layout Description
fortune
\begin_inset LatexCommand \index{fortune}
\end_inset
\emph on
fortune
\emph default
is a tool
\begin_inset LatexCommand \index{tool}
\end_inset
which will print
\begin_inset LatexCommand \index{print}
\end_inset
a random,
\begin_inset LatexCommand \index{random}
\end_inset
hopefully interesting quote
\begin_inset LatexCommand \index{quote}
\end_inset
or entertaining short
\begin_inset LatexCommand \index{short}
\end_inset
piece
\begin_inset LatexCommand \index{piece}
\end_inset
of writing.
\begin_inset LatexCommand \index{writing}
\end_inset
There are options
\begin_inset LatexCommand \index{options}
\end_inset
to customise
\begin_inset LatexCommand \index{customise}
\end_inset
which area
\begin_inset LatexCommand \index{area}
\end_inset
the epigrams
\begin_inset LatexCommand \index{epigrams}
\end_inset
should come from.
Just type
\emph on
fortune
\emph default
to get a random
\begin_inset LatexCommand \index{random}
\end_inset
epigram
\begin_inset LatexCommand \index{epigram}
\end_inset
from any section.
\begin_inset LatexCommand \index{section}
\end_inset
\begin_deeper
\layout Standard
Simply type:
\layout Code
fortune
\end_deeper
\layout Chapter
Mini-Guides
\begin_inset LatexCommand \label{Mini-guides}
\end_inset
\layout Standard
The mini-guides
\begin_inset LatexCommand \index{mini-guides}
\end_inset
chapter is a section
\begin_inset LatexCommand \index{section}
\end_inset
of the document
\begin_inset LatexCommand \index{document}
\end_inset
that describes
\begin_inset LatexCommand \index{describes}
\end_inset
certain concepts
\begin_inset LatexCommand \index{concepts}
\end_inset
in more
\begin_inset LatexCommand \index{more}
\end_inset
depth
\begin_inset LatexCommand \index{depth}
\end_inset
than the usual command
\begin_inset LatexCommand \index{command}
\end_inset
descriptions.
\begin_inset LatexCommand \index{descriptions}
\end_inset
The information
\begin_inset LatexCommand \index{information}
\end_inset
listed is fairly specific
\begin_inset LatexCommand \index{specific}
\end_inset
as I have tried
\begin_inset LatexCommand \index{tried}
\end_inset
to avoid
\begin_inset LatexCommand \index{avoid}
\end_inset
the duplication
\begin_inset LatexCommand \index{duplication}
\end_inset
of too much information
\begin_inset LatexCommand \index{information}
\end_inset
that is already online.
\begin_inset LatexCommand \index{online}
\end_inset
\layout Section
RPM:
\begin_inset LatexCommand \label{RPM}
\end_inset
Redhat Package Management System
\layout Standard
\begin_inset Note
collapsed true
\layout Standard
Done in sooo many tutorials that I think its pointless repeating it (although
I thought it was pretty good :P)
\layout Standard
Installing, removing and querying packages
\begin_inset LatexCommand \label{installing-removing-and-querying-packages}
\end_inset
\layout Standard
Command syntax:
\layout Code
rpm -option package_name
\layout Standard
\series bold
Options
\layout Itemize
\noindent
\series bold
\shape italic
\emph on
-i
\series default
\shape default
\emph default
--- install a new package
\layout Itemize
\noindent
\series bold
\shape italic
\emph on
-U
\series default
\shape default
\emph default
--- upgrades or Installs a package
\layout Itemize
\noindent
\series bold
\shape italic
\emph on
-e
\series default
\shape default
\emph default
--- removes the package from the system (un-install)
\layout Itemize
\noindent
\series bold
\shape italic
\emph on
-v
\series default
\shape default
\emph default
--- be more verbose, tell the user more of what the program is doing.
\layout Itemize
\noindent
\series bold
\shape italic
\emph on
-h
\series default
\shape default
\emph default
--- hash marks (use # (hash marks) as a progress meter.)
\layout Itemize
\series bold
-q
\series default
--- queries package database for information.
Use
\emph on
-qa
\emph default
to list all installed packages.
Try
\emph on
rpm -qa rpmfile
\emph default
to find the full name of a particular rpm.
Use the
\emph on
-ql
\emph default
option to list installed files of a particular package.
Use the
\layout Itemize
\series bold
-qf
\series default
\emph on
\emph default
--- option to see which package a particular file came from and use
\emph on
-qi
\emph default
to query further information on a package.
\layout Itemize
\series bold
-V
\series default
--- check whether a package has been changed (see below
\begin_inset LatexCommand \ref{checking-installed-RPMS}
\end_inset
).
\layout SGML
\layout SGML
Tip
\layout SGML
\layout SGML
Use
\emph on
-U
\emph default
instead of
\emph on
-i
\emph default
this will install the program if it's not there and upgrade if it already
exists.
\layout SGML
\layout SGML
\layout SGML
\layout SGML
Please note that
\layout SGML
\layout SGML
Using the
\emph on
-U
\emph default
option when upgrading the kernel ('linux') will remove the old version.
It is recommended you use the
\emph on
-i
\emph default
switch if you upgrade your kernel from RPM.
\layout SGML
\layout SGML
\layout Standard
\noindent
To check a RPM signature package, use the command:
\layout Code
\noindent
rpm -checksig package_name
\layout Standard
\noindent
This command checks the PGP signature of specified package to ensure it's
integrity and origin.
Always use this command first before installing new RPM package on your
system.
GnuPG (GNU Privacy Guard) or PGP software must be already installed on
your system before you can use this command.
\layout SGML
\end_inset
\layout Description
\noindent
Checking
\begin_inset LatexCommand \index{Checking}
\end_inset
\series bold
Installed
\begin_inset LatexCommand \index{Installed}
\end_inset
RPM's
\layout Standard
\noindent
Use the
\emph on
rpm
\begin_inset LatexCommand \index{rpm}
\end_inset
-V
\begin_inset LatexCommand \index{-V}
\end_inset
\emph default
option
\begin_inset LatexCommand \index{option}
\end_inset
to check
\begin_inset LatexCommand \index{check}
\end_inset
whether or not a package
\begin_inset LatexCommand \index{package}
\end_inset
has been modified.
\begin_inset LatexCommand \index{modified}
\end_inset
\layout Standard
\noindent
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\layout Code
\noindent
rpm -V textutils
\layout Standard
\noindent
If none
\begin_inset LatexCommand \index{none}
\end_inset
of the files
\begin_inset LatexCommand \index{files}
\end_inset
from the textutils
\begin_inset LatexCommand \index{textutils}
\end_inset
package
\begin_inset LatexCommand \index{package}
\end_inset
have changed then rpm
\begin_inset LatexCommand \index{rpm}
\end_inset
will exit
\begin_inset LatexCommand \index{exit}
\end_inset
without outputting any data.
\begin_inset LatexCommand \index{data}
\end_inset
If, on the other hand,
\begin_inset LatexCommand \index{hand}
\end_inset
the program
\begin_inset LatexCommand \index{program}
\end_inset
has changed, you may see something like this:
\layout Code
\noindent
U.5....T /bin/cat
\layout Standard
\noindent
This isn't as cryptic
\begin_inset LatexCommand \index{cryptic}
\end_inset
as it appears.
The line
\begin_inset LatexCommand \index{line}
\end_inset
returned
\begin_inset LatexCommand \index{returned}
\end_inset
from
\emph on
rpm
\begin_inset LatexCommand \index{rpm}
\end_inset
-V
\begin_inset LatexCommand \index{-V}
\end_inset
\emph default
contains any number
\begin_inset LatexCommand \index{number}
\end_inset
of eight
\begin_inset LatexCommand \index{eight}
\end_inset
characters plus the full
\begin_inset LatexCommand \index{full}
\end_inset
path
\begin_inset LatexCommand \index{path}
\end_inset
to the file.
\begin_inset LatexCommand \index{file}
\end_inset
Here are the characters
\begin_inset LatexCommand \index{characters}
\end_inset
and their meaning:
\begin_inset LatexCommand \index{meaning}
\end_inset
\begin_inset Foot
collapsed true
\layout Standard
Note that the list under section 24.1.2 comes from the RPM manual page, see
[11] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further details.
\end_inset
\layout Itemize
\noindent
\series bold
S
\series default
--- file
\begin_inset LatexCommand \index{file}
\end_inset
Size
\begin_inset LatexCommand \index{Size}
\end_inset
differs
\layout Itemize
\noindent
\series bold
M
\series default
--- Mode
\begin_inset LatexCommand \index{Mode}
\end_inset
differs (includes permissions
\begin_inset LatexCommand \index{permissions}
\end_inset
and file
\begin_inset LatexCommand \index{file}
\end_inset
type)
\layout Itemize
\noindent
\series bold
5
\series default
--- MD5
\begin_inset LatexCommand \index{MD5}
\end_inset
sum
\begin_inset LatexCommand \index{sum}
\end_inset
differs
\layout Itemize
\noindent
\series bold
D
\series default
--- Device
\begin_inset LatexCommand \index{Device}
\end_inset
major/minor number
\begin_inset LatexCommand \index{number}
\end_inset
mis-match
\begin_inset LatexCommand \index{mis-match}
\end_inset
\layout Itemize
\noindent
\series bold
L
\series default
--- readLink(2) path
\begin_inset LatexCommand \index{path}
\end_inset
mis-match
\layout Itemize
\noindent
\series bold
U
\series default
--- User ownership
\begin_inset LatexCommand \index{ownership}
\end_inset
differs
\layout Itemize
\noindent
\series bold
G
\series default
--- Group
\begin_inset LatexCommand \index{Group}
\end_inset
ownership
\begin_inset LatexCommand \index{ownership}
\end_inset
differs
\layout Itemize
\noindent
\series bold
T
\series default
--- mTime
\begin_inset LatexCommand \index{mTime}
\end_inset
differs
\layout SGML
\layout SGML
Mandriva Users Note
\layout SGML
\layout SGML
Mandriva
\begin_inset LatexCommand \index{Mandriva}
\end_inset
Linux uses a customised version of RPM called urpmi (It consists of the
urpm* commands, urpmi to install, urpme to remove and urpmf and urpmq to
query).
\layout SGML
\layout SGML
\layout SGML
This customised version has advantages over standard RPM, including automatic-de
pendency solving and Debian apt-get style functions (ability to download
programs over the internet and have all dependencies resolved automatically).
\layout SGML
\layout SGML
\layout SGML
The urpm* commands are all described in detail in Mandriva's documentation
and various sources online.
\layout SGML
\layout SGML
\layout Section
Checking the Hard Disk for errors
\begin_inset LatexCommand \label{checking-the-hard-disk}
\end_inset
\layout Standard
Checking
\begin_inset LatexCommand \index{Checking}
\end_inset
the hard disk
\begin_inset LatexCommand \index{disk}
\end_inset
for errors
\begin_inset LatexCommand \index{errors}
\end_inset
on your primary
\begin_inset LatexCommand \index{primary}
\end_inset
drive is very, very rarely required
\begin_inset LatexCommand \index{required}
\end_inset
in GNU/Linux, most checking
\begin_inset LatexCommand \index{checking}
\end_inset
is automated
\begin_inset LatexCommand \index{automated}
\end_inset
on start-up
\begin_inset LatexCommand \index{start-up}
\end_inset
if it is required.
\begin_inset LatexCommand \index{required}
\end_inset
If you do need to check
\begin_inset LatexCommand \index{check}
\end_inset
the hard disk
\begin_inset LatexCommand \index{disk}
\end_inset
for errors
\begin_inset LatexCommand \index{errors}
\end_inset
you will first need to unmount
\begin_inset LatexCommand \index{unmount}
\end_inset
it.
Then use the file
\begin_inset LatexCommand \index{file}
\end_inset
system
\begin_inset LatexCommand \index{system}
\end_inset
checker,
\emph on
fsck
\emph default
.
\layout Code
fsck.file_system_type
\layout Standard
If you had an ext3
\begin_inset LatexCommand \index{ext3}
\end_inset
file-system then it would be:
\layout Code
fsck.ext3
\layout SGML
\layout SGML
Also try
\layout SGML
\layout SGML
You can also try using:
\layout SGML
\layout SGML
fsck -t file_system_type
\layout SGML
\layout SGML
\layout SGML
\layout Section
Duplicating disks
\begin_inset LatexCommand \label{duplicating-disks}
\end_inset
\layout Standard
This simple technique
\begin_inset LatexCommand \index{technique}
\end_inset
shows you how you would duplicate
\begin_inset LatexCommand \index{duplicate}
\end_inset
floppy disks
\begin_inset LatexCommand \index{disks}
\end_inset
in a GNU/Linux system
\begin_inset LatexCommand \index{system}
\end_inset
using dd.
\begin_inset LatexCommand \index{dd}
\end_inset
This technique
\begin_inset LatexCommand \index{technique}
\end_inset
is not as useful as it used to be but can still be used for creating an
image
\begin_inset LatexCommand \index{image}
\end_inset
of a cd
\begin_inset LatexCommand \index{cd}
\end_inset
(although that is best done through the cd burning
\begin_inset LatexCommand \index{burning}
\end_inset
program).
\layout Standard
This information
\begin_inset LatexCommand \index{information}
\end_inset
has been taken
\begin_inset LatexCommand \index{taken}
\end_inset
from the Linux
\begin_inset LatexCommand \index{Linux}
\end_inset
Online
\begin_inset LatexCommand \index{Online}
\end_inset
Classroom,
\begin_inset LatexCommand \index{Classroom}
\end_inset
see [4] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further details.
\begin_inset LatexCommand \index{details}
\end_inset
\layout Code
\series bold
$
\series default
dd if=/dev/fd0 of=floppy-image
\layout Code
\series bold
$
\series default
dd if=floppy-image of=/dev/fd0
\layout Standard
The first dd
\begin_inset LatexCommand \index{dd}
\end_inset
makes an exact
\begin_inset LatexCommand \index{exact}
\end_inset
image of the floppy
\begin_inset LatexCommand \index{floppy}
\end_inset
to the file
\begin_inset LatexCommand \index{file}
\end_inset
floppy-image,
\begin_inset LatexCommand \index{floppy-image}
\end_inset
the second one writes
\begin_inset LatexCommand \index{writes}
\end_inset
the image
\begin_inset LatexCommand \index{image}
\end_inset
to the floppy.
\begin_inset LatexCommand \index{floppy}
\end_inset
(The user
\begin_inset LatexCommand \index{user}
\end_inset
has presumably switched
\begin_inset LatexCommand \index{switched}
\end_inset
the floppy
\begin_inset LatexCommand \index{floppy}
\end_inset
before the second command.
\begin_inset LatexCommand \index{command}
\end_inset
Otherwise the command
\begin_inset LatexCommand \index{command}
\end_inset
pair is of doubtful usefulness).
\layout Standard
Similar techinques
\begin_inset LatexCommand \index{techinques}
\end_inset
can be used when creating bootdisks,
\begin_inset LatexCommand \index{bootdisks}
\end_inset
you simply use dd
\begin_inset LatexCommand \index{dd}
\end_inset
to transfer
\begin_inset LatexCommand \index{transfer}
\end_inset
the image
\begin_inset LatexCommand \index{image}
\end_inset
to the floppy
\begin_inset LatexCommand \index{floppy}
\end_inset
disk.
\begin_inset LatexCommand \index{disk}
\end_inset
\layout Section
Wildcards
\begin_inset LatexCommand \label{wildcards}
\end_inset
\layout Standard
Wildcars
\begin_inset LatexCommand \index{Wildcars}
\end_inset
are useful in many ways for a GNU/Linux system
\begin_inset LatexCommand \index{system}
\end_inset
and for various other uses.
Commands
\begin_inset LatexCommand \index{Commands}
\end_inset
can use wildcards
\begin_inset LatexCommand \index{wildcards}
\end_inset
to perform
\begin_inset LatexCommand \index{perform}
\end_inset
actions
\begin_inset LatexCommand \index{actions}
\end_inset
on more
\begin_inset LatexCommand \index{more}
\end_inset
than one file
\begin_inset LatexCommand \index{file}
\end_inset
at a time,
\begin_inset LatexCommand \index{time}
\end_inset
or to find
\begin_inset LatexCommand \index{find}
\end_inset
part of a phrase
\begin_inset LatexCommand \index{phrase}
\end_inset
in a text
\begin_inset LatexCommand \index{text}
\end_inset
file.
There are many uses for wildcards,
\begin_inset LatexCommand \index{wildcards}
\end_inset
there are two different
\begin_inset LatexCommand \index{different}
\end_inset
major
\begin_inset LatexCommand \index{major}
\end_inset
ways that wildcards
\begin_inset LatexCommand \index{wildcards}
\end_inset
are used, they are globbing
\begin_inset LatexCommand \index{globbing}
\end_inset
patterns/standard wildcards
\begin_inset LatexCommand \index{wildcards}
\end_inset
that are often used by the shell.
\begin_inset LatexCommand \index{shell}
\end_inset
The alternative
\begin_inset LatexCommand \index{alternative}
\end_inset
is regular
\begin_inset LatexCommand \index{regular}
\end_inset
expressions, popular
\begin_inset LatexCommand \index{popular}
\end_inset
with many other commands
\begin_inset LatexCommand \index{commands}
\end_inset
and popular
\begin_inset LatexCommand \index{popular}
\end_inset
for use with text
\begin_inset LatexCommand \index{text}
\end_inset
searching
\begin_inset LatexCommand \index{searching}
\end_inset
and manipulation.
\begin_inset LatexCommand \index{manipulation}
\end_inset
\layout SGML
\layout SGML
Tip
\layout SGML
\layout SGML
If you have a file with wildcard expressions in it then you can use single
quotes to stop bash expanding them or use backslashes (escape characters),
or both.
\layout SGML
\layout SGML
\layout SGML
For example if you wanted to create a file called 'fo*' (fo and asterisk)
you would have to do it like this (note that you shouldn't create files
with names like this, this is just an example):
\layout SGML
\layout SGML
touch 'fo*'
\layout SGML
\layout SGML
\layout SGML
\layout Standard
Note that parts
\begin_inset LatexCommand \index{parts}
\end_inset
of both subsections
\begin_inset LatexCommand \index{subsections}
\end_inset
on wildcards
\begin_inset LatexCommand \index{wildcards}
\end_inset
are based (at least
\begin_inset LatexCommand \index{least}
\end_inset
in part) off
\begin_inset LatexCommand \index{off}
\end_inset
the grep
\begin_inset LatexCommand \index{grep}
\end_inset
manual
\begin_inset LatexCommand \index{manual}
\end_inset
and info
\begin_inset LatexCommand \index{info}
\end_inset
pages.
Please see the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\begin_inset LatexCommand \index{information}
\end_inset
\layout Subsection
Standard Wildcards (globbing patterns)
\begin_inset LatexCommand \label{standard-wildcards}
\end_inset
\layout Standard
Standard
\begin_inset LatexCommand \index{Standard}
\end_inset
wildcards
\begin_inset LatexCommand \index{wildcards}
\end_inset
(also known as globbing
\begin_inset LatexCommand \index{globbing}
\end_inset
patterns) are used by various command
\begin_inset LatexCommand \index{command}
\end_inset
line utilities
\begin_inset LatexCommand \index{utilities}
\end_inset
to work
\begin_inset LatexCommand \index{work}
\end_inset
with multiple
\begin_inset LatexCommand \index{multiple}
\end_inset
files.
\begin_inset LatexCommand \index{files}
\end_inset
For more
\begin_inset LatexCommand \index{more}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
(globbing patterns) refer
\begin_inset LatexCommand \index{refer}
\end_inset
to the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
by typing:
\layout Code
man 7 glob
\layout SGML
\layout SGML
Can be used by
\layout SGML
\layout SGML
Standard wildcards are used by nearly any command (including mv, cp, rm
and many others).
\layout SGML
\layout SGML
\layout Description
\noindent
?\SpecialChar ~
(question\SpecialChar ~
mark)
\begin_inset LatexCommand \index{question mark}
\end_inset
\begin_inset LatexCommand \index{?}
\end_inset
this can represent
\begin_inset LatexCommand \index{represent}
\end_inset
any
\emph on
single
\emph default
character.
If you specified
\begin_inset LatexCommand \index{specified}
\end_inset
something at the command
\begin_inset LatexCommand \index{command}
\end_inset
line like "hd?" GNU/Linux would look
\begin_inset LatexCommand \index{look}
\end_inset
for hda,
\begin_inset LatexCommand \index{hda}
\end_inset
hdb,
\begin_inset LatexCommand \index{hdb}
\end_inset
hdc
\begin_inset LatexCommand \index{hdc}
\end_inset
and every other letter/number between a-z,
\begin_inset LatexCommand \index{a-z}
\end_inset
0-9.
\layout Description
\noindent
*\SpecialChar ~
(asterisk)
\begin_inset LatexCommand \index{asterisk}
\end_inset
\begin_inset LatexCommand \index{*}
\end_inset
this can represent
\begin_inset LatexCommand \index{represent}
\end_inset
any number
\begin_inset LatexCommand \index{number}
\end_inset
of characters
\begin_inset LatexCommand \index{characters}
\end_inset
(including zero,
\begin_inset LatexCommand \index{zero}
\end_inset
in other words,
\begin_inset LatexCommand \index{words}
\end_inset
zero
\begin_inset LatexCommand \index{zero}
\end_inset
or more
\begin_inset LatexCommand \index{more}
\end_inset
characters).
If you specified
\begin_inset LatexCommand \index{specified}
\end_inset
a "cd*" it would use "cda", "cdrom"
\begin_inset LatexCommand \index{cdrom}
\end_inset
, "cdrecord"
\begin_inset LatexCommand \index{cdrecord}
\end_inset
and
\emph on
anything
\emph default
that starts
\begin_inset LatexCommand \index{starts}
\end_inset
with
\begin_inset Quotes eld
\end_inset
cd
\begin_inset Quotes erd
\end_inset
also including
\begin_inset LatexCommand \index{including}
\end_inset
\begin_inset Quotes eld
\end_inset
cd
\begin_inset Quotes erd
\end_inset
itself.
"m*l" could by mill, mull,
\begin_inset LatexCommand \index{mull}
\end_inset
ml, and anything that starts
\begin_inset LatexCommand \index{starts}
\end_inset
with an m and ends
\begin_inset LatexCommand \index{ends}
\end_inset
with an l.
\layout Description
\noindent
[\SpecialChar ~
]\SpecialChar ~
(square\SpecialChar ~
brackets)
\begin_inset LatexCommand \index{brackets, square}
\end_inset
\begin_inset LatexCommand \index{[ ]}
\end_inset
specifies
\begin_inset LatexCommand \index{specifies}
\end_inset
a range.
\begin_inset LatexCommand \index{range}
\end_inset
If you did m[a,o,u]m it can become: mam, mum,
\begin_inset LatexCommand \index{mum}
\end_inset
mom
\begin_inset LatexCommand \index{mom}
\end_inset
if you did: m[a-d]m it can become anything that starts
\begin_inset LatexCommand \index{starts}
\end_inset
and ends
\begin_inset LatexCommand \index{ends}
\end_inset
with m and has any character
\begin_inset LatexCommand \index{character}
\end_inset
a to d in-between.
\begin_inset LatexCommand \index{in-between}
\end_inset
For example,
\begin_inset LatexCommand \index{example}
\end_inset
these would work:
\begin_inset LatexCommand \index{work}
\end_inset
mam, mbm,
\begin_inset LatexCommand \index{mbm}
\end_inset
mcm,
\begin_inset LatexCommand \index{mcm}
\end_inset
mdm.
\begin_inset LatexCommand \index{mdm}
\end_inset
This kind
\begin_inset LatexCommand \index{kind}
\end_inset
of wildcard
\begin_inset LatexCommand \index{wildcard}
\end_inset
specifies
\begin_inset LatexCommand \index{specifies}
\end_inset
an
\begin_inset Quotes eld
\end_inset
or
\begin_inset Quotes erd
\end_inset
relationship
\begin_inset LatexCommand \index{relationship}
\end_inset
(you only need one to match).
\layout Description
{\SpecialChar ~
}\SpecialChar ~
(curly\SpecialChar ~
brackets)
\begin_inset LatexCommand \index{brackets, curly}
\end_inset
\begin_inset LatexCommand \index{{ }}
\end_inset
terms
\begin_inset LatexCommand \index{terms}
\end_inset
are separated
\begin_inset LatexCommand \index{separated}
\end_inset
by commas
\begin_inset LatexCommand \index{commas}
\end_inset
and each term
\begin_inset LatexCommand \index{term}
\end_inset
must be the name of something or a wildcard.
\begin_inset LatexCommand \index{wildcard}
\end_inset
This wildcard
\begin_inset LatexCommand \index{wildcard}
\end_inset
will copy
\begin_inset LatexCommand \index{copy}
\end_inset
anything that matches either wildcard(s), or exact
\begin_inset LatexCommand \index{exact}
\end_inset
name(s) (an
\begin_inset Quotes eld
\end_inset
or
\begin_inset Quotes erd
\end_inset
relationship,
\begin_inset LatexCommand \index{relationship}
\end_inset
one or the other).
\begin_deeper
\layout Standard
For example,
\begin_inset LatexCommand \index{example}
\end_inset
this would be valid:
\begin_inset LatexCommand \index{valid}
\end_inset
\layout Code
cp {*.doc,*.pdf} ~
\layout Standard
This will copy
\begin_inset LatexCommand \index{copy}
\end_inset
anything ending
\begin_inset LatexCommand \index{ending}
\end_inset
with .doc
\begin_inset LatexCommand \index{.doc}
\end_inset
or .pdf
\begin_inset LatexCommand \index{.pdf}
\end_inset
to the users
\begin_inset LatexCommand \index{users}
\end_inset
home
\begin_inset LatexCommand \index{home}
\end_inset
directory.
\begin_inset LatexCommand \index{directory}
\end_inset
Note that spaces
\begin_inset LatexCommand \index{spaces}
\end_inset
are not allowed
\begin_inset LatexCommand \index{allowed}
\end_inset
after the commas
\begin_inset LatexCommand \index{commas}
\end_inset
(or anywhere else).
\end_deeper
\layout Description
\noindent
\series bold
[!]
\series default
\begin_inset LatexCommand \index{[!]}
\end_inset
This construct is similar
\begin_inset LatexCommand \index{similar}
\end_inset
to the
\series bold
[\SpecialChar ~
]
\series default
construct, except rather
\begin_inset LatexCommand \index{rather}
\end_inset
than matching
\begin_inset LatexCommand \index{matching}
\end_inset
any characters
\begin_inset LatexCommand \index{characters}
\end_inset
inside
\begin_inset LatexCommand \index{inside}
\end_inset
the brackets,
\begin_inset LatexCommand \index{brackets}
\end_inset
it'll match
\begin_inset LatexCommand \index{match}
\end_inset
any character,
\begin_inset LatexCommand \index{character}
\end_inset
as long
\begin_inset LatexCommand \index{long}
\end_inset
as it is
\shape italic
\begin_inset LatexCommand \index{italic}
\end_inset
not
\shape default
\begin_inset LatexCommand \index{default}
\end_inset
listed
\begin_inset LatexCommand \index{listed}
\end_inset
between the
\series bold
[
\series default
and
\series bold
]
\series default
.
This is a logical
\begin_inset LatexCommand \index{logical}
\end_inset
NOT.
\begin_inset LatexCommand \index{NOT}
\end_inset
For example
\begin_inset LatexCommand \index{example}
\end_inset
\emph on
rm
\begin_inset LatexCommand \index{rm}
\end_inset
myfile[!9]
\emph default
will remove
\begin_inset LatexCommand \index{remove}
\end_inset
all myfiles* (ie.
myfiles1,
\begin_inset LatexCommand \index{myfiles1}
\end_inset
myfiles2
\begin_inset LatexCommand \index{myfiles2}
\end_inset
etc) but won't remove
\begin_inset LatexCommand \index{remove}
\end_inset
a file
\begin_inset LatexCommand \index{file}
\end_inset
with the number
\begin_inset LatexCommand \index{number}
\end_inset
9 anywhere within it's name.
\layout Description
\backslash
\SpecialChar ~
(backslash)
\begin_inset LatexCommand \index{backslash}
\end_inset
\begin_inset LatexCommand \index{\}
\end_inset
is used as an "escape"
\begin_inset LatexCommand \index{escape}
\end_inset
character,
\begin_inset LatexCommand \index{character}
\end_inset
i.e.
to protect
\begin_inset LatexCommand \index{protect}
\end_inset
a subsequent
\begin_inset LatexCommand \index{subsequent}
\end_inset
special
\begin_inset LatexCommand \index{special}
\end_inset
character.
\begin_inset LatexCommand \index{character}
\end_inset
Thus, "
\backslash
\backslash
\begin_inset Quotes erd
\end_inset
searches
\begin_inset LatexCommand \index{searches}
\end_inset
for a backslash.
\begin_inset LatexCommand \index{backslash}
\end_inset
Note you may need to use quotation
\begin_inset LatexCommand \index{quotation}
\end_inset
marks and backslash(es).
\layout Subsection
Regular Expressions
\begin_inset LatexCommand \label{regular-expressions}
\end_inset
\layout Standard
Regular
\begin_inset LatexCommand \index{Regular}
\end_inset
expressions
\begin_inset LatexCommand \index{expressions}
\end_inset
are a type of globbing
\begin_inset LatexCommand \index{globbing}
\end_inset
pattern
\begin_inset LatexCommand \index{pattern}
\end_inset
used when working
\begin_inset LatexCommand \index{working}
\end_inset
with text.
\begin_inset LatexCommand \index{text}
\end_inset
They are used for any form
\begin_inset LatexCommand \index{form}
\end_inset
of manipulation
\begin_inset LatexCommand \index{manipulation}
\end_inset
of multiple
\begin_inset LatexCommand \index{multiple}
\end_inset
parts
\begin_inset LatexCommand \index{parts}
\end_inset
of text
\begin_inset LatexCommand \index{text}
\end_inset
and by various programming
\begin_inset LatexCommand \index{programming}
\end_inset
languages that work
\begin_inset LatexCommand \index{work}
\end_inset
with text.
\begin_inset LatexCommand \index{text}
\end_inset
For more
\begin_inset LatexCommand \index{more}
\end_inset
information
\begin_inset LatexCommand \index{information}
\end_inset
on regular
\begin_inset LatexCommand \index{regular}
\end_inset
expressions refer
\begin_inset LatexCommand \index{refer}
\end_inset
to the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
or try
\begin_inset LatexCommand \index{try}
\end_inset
an online
\begin_inset LatexCommand \index{online}
\end_inset
tutorial, for example
\begin_inset LatexCommand \index{example}
\end_inset
IBM
\begin_inset LatexCommand \index{IBM}
\end_inset
Developerworks
\begin_inset LatexCommand \url[using regular expressions]{https://www6.software.ibm.com/developerworks/education/l-regexp/index.html}
\end_inset
.
For the manual
\begin_inset LatexCommand \index{manual}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
type:
\layout Standard
Type:
\layout Code
man 7 regex
\layout SGML
\layout SGML
Regular expressions can be used by
\layout SGML
\layout SGML
Regular Expressions are used by
\emph on
grep
\emph default
(and can be used) by
\emph on
find
\emph default
and many other programs.
\begin_inset Note
collapsed true
\layout Standard
can anyone suggest some other programs\SpecialChar \ldots{}
besides grep
\end_inset
\layout SGML
\layout SGML
\layout SGML
\layout SGML
Tip
\layout SGML
If your regular expressions don't seem to be working then you probably
need to use single quotation marks over the sentence and then use backslashes
on every single special character.
\layout SGML
\layout SGML
\layout Description
\noindent
.\SpecialChar ~
(dot)
\begin_inset LatexCommand \index{dot}
\end_inset
\begin_inset LatexCommand \index{.}
\end_inset
will match
\begin_inset LatexCommand \index{match}
\end_inset
\emph on
any single character
\begin_inset LatexCommand \index{character}
\end_inset
\emph default
, equivalent
\begin_inset LatexCommand \index{equivalent}
\end_inset
to ? (question mark) in standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcard expressions.
\begin_inset LatexCommand \index{expressions}
\end_inset
Thus, "m.a" matches "mpa" and "mea" but not "ma" or "mppa".
\layout Description
\noindent
\backslash
\SpecialChar ~
(backslash)
\begin_inset LatexCommand \index{backslash}
\end_inset
\begin_inset LatexCommand \index{\}
\end_inset
is used as an "escape"
\begin_inset LatexCommand \index{escape}
\end_inset
character,
\begin_inset LatexCommand \index{character}
\end_inset
i.e.
to protect
\begin_inset LatexCommand \index{protect}
\end_inset
a subsequent
\begin_inset LatexCommand \index{subsequent}
\end_inset
special
\begin_inset LatexCommand \index{special}
\end_inset
character.
\begin_inset LatexCommand \index{character}
\end_inset
Thus, "
\backslash
\backslash
" searches
\begin_inset LatexCommand \index{searches}
\end_inset
for a backslash.
\begin_inset LatexCommand \index{backslash}
\end_inset
Note you may need to use quotation
\begin_inset LatexCommand \index{quotation}
\end_inset
marks and backslash(es).
\layout Description
\noindent
.*\SpecialChar ~
(dot\SpecialChar ~
and\SpecialChar ~
asterisk)
\begin_inset LatexCommand \index{dot asterisk}
\end_inset
\begin_inset LatexCommand \index{.*}
\end_inset
is used to match
\begin_inset LatexCommand \index{match}
\end_inset
any string,
\begin_inset LatexCommand \index{string}
\end_inset
equivalent
\begin_inset LatexCommand \index{equivalent}
\end_inset
to * in standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards.
\begin_inset LatexCommand \index{wildcards}
\end_inset
\layout Description
\noindent
*\SpecialChar ~
(asterisk)
\begin_inset LatexCommand \index{asterisk}
\end_inset
\begin_inset LatexCommand \index{*}
\end_inset
the proceeding
\begin_inset LatexCommand \index{proceeding}
\end_inset
item is to be matched
\begin_inset LatexCommand \index{matched}
\end_inset
\emph on
zero
\begin_inset LatexCommand \index{zero}
\end_inset
or more
\begin_inset LatexCommand \index{more}
\end_inset
\emph default
times.
\begin_inset LatexCommand \index{times}
\end_inset
ie.
n* will match
\begin_inset LatexCommand \index{match}
\end_inset
n, nn,
\begin_inset LatexCommand \index{nn}
\end_inset
nnnn,
\begin_inset LatexCommand \index{nnnn}
\end_inset
nnnnnnn
\begin_inset LatexCommand \index{nnnnnnn}
\end_inset
but not na or any other character.
\begin_inset LatexCommand \index{character}
\end_inset
\layout Description
\noindent
^\SpecialChar ~
(caret)
\begin_inset LatexCommand \index{caret}
\end_inset
\begin_inset LatexCommand \index{^}
\end_inset
means "the beginning
\begin_inset LatexCommand \index{beginning}
\end_inset
of the line".
So "^a" means find
\begin_inset LatexCommand \index{find}
\end_inset
a line
\begin_inset LatexCommand \index{line}
\end_inset
starting
\begin_inset LatexCommand \index{starting}
\end_inset
with an "a".
\layout Description
\noindent
$\SpecialChar ~
(dollar\SpecialChar ~
sign)
\begin_inset LatexCommand \index{dollar sign}
\end_inset
\begin_inset LatexCommand \index{$}
\end_inset
means "the end
\begin_inset LatexCommand \index{end}
\end_inset
of the line".
So "a$" means find
\begin_inset LatexCommand \index{find}
\end_inset
a line
\begin_inset LatexCommand \index{line}
\end_inset
ending with an "a".
\begin_deeper
\layout Standard
\noindent
Example: This command
\begin_inset LatexCommand \index{command}
\end_inset
searches
\begin_inset LatexCommand \index{searches}
\end_inset
the file
\begin_inset LatexCommand \index{file}
\end_inset
myfile
\begin_inset LatexCommand \index{myfile}
\end_inset
for lines
\begin_inset LatexCommand \index{lines}
\end_inset
starting
\begin_inset LatexCommand \index{starting}
\end_inset
with an "s" and ending
\begin_inset LatexCommand \index{ending}
\end_inset
with an "n", and prints
\begin_inset LatexCommand \index{prints}
\end_inset
them to the standard
\begin_inset LatexCommand \index{standard}
\end_inset
output
\begin_inset LatexCommand \index{standard output}
\end_inset
\begin_inset LatexCommand \index{output}
\end_inset
(screen):
\layout Code
\noindent
cat myfile | grep '^s.*n$'
\end_deeper
\layout Description
[\SpecialChar ~
]\SpecialChar ~
(square\SpecialChar ~
brackets)
\begin_inset LatexCommand \index{brackets, square}
\end_inset
\begin_inset LatexCommand \index{[ ]}
\end_inset
specifies
\begin_inset LatexCommand \index{specifies}
\end_inset
a range.
\begin_inset LatexCommand \index{range}
\end_inset
If you did m[a,o,u]m it can become: mam, mum,
\begin_inset LatexCommand \index{mum}
\end_inset
mom
\begin_inset LatexCommand \index{mom}
\end_inset
if you did: m[a-d]m it can become anything that starts
\begin_inset LatexCommand \index{starts}
\end_inset
and ends
\begin_inset LatexCommand \index{ends}
\end_inset
with m and has any character
\begin_inset LatexCommand \index{character}
\end_inset
a to d in-between.
\begin_inset LatexCommand \index{in-between}
\end_inset
For example,
\begin_inset LatexCommand \index{example}
\end_inset
these would work:
\begin_inset LatexCommand \index{work}
\end_inset
mam, mbm,
\begin_inset LatexCommand \index{mbm}
\end_inset
mcm,
\begin_inset LatexCommand \index{mcm}
\end_inset
mdm.
\begin_inset LatexCommand \index{mdm}
\end_inset
This kind
\begin_inset LatexCommand \index{kind}
\end_inset
of wildcard
\begin_inset LatexCommand \index{wildcard}
\end_inset
specifies
\begin_inset LatexCommand \index{specifies}
\end_inset
an
\begin_inset Quotes eld
\end_inset
or
\begin_inset Quotes erd
\end_inset
relationship
\begin_inset LatexCommand \index{relationship}
\end_inset
(you only need one to match).
\layout Description
|
\begin_inset LatexCommand \index{|}
\end_inset
This wildcard
\begin_inset LatexCommand \index{wildcard}
\end_inset
makes a logical
\begin_inset LatexCommand \index{logical}
\end_inset
OR
\begin_inset LatexCommand \index{OR}
\end_inset
relationship
\begin_inset LatexCommand \index{relationship}
\end_inset
between wildcards.
\begin_inset LatexCommand \index{wildcards}
\end_inset
This way you can search
\begin_inset LatexCommand \index{search}
\end_inset
for something or something else (possibly using two different
\begin_inset LatexCommand \index{different}
\end_inset
regular
\begin_inset LatexCommand \index{regular}
\end_inset
expressions).
You may need to add
\begin_inset LatexCommand \index{add}
\end_inset
a '
\backslash
' (backslash) before this command
\begin_inset LatexCommand \index{command}
\end_inset
to work,
\begin_inset LatexCommand \index{work}
\end_inset
because the shell
\begin_inset LatexCommand \index{shell}
\end_inset
may attempt
\begin_inset LatexCommand \index{attempt}
\end_inset
to interpret
\begin_inset LatexCommand \index{interpret}
\end_inset
this as a pipe.
\begin_inset LatexCommand \index{pipe}
\end_inset
\layout Description
[^]
\begin_inset LatexCommand \index{[^]}
\end_inset
This is the equivalent
\begin_inset LatexCommand \index{equivalent}
\end_inset
of [!] in standard
\begin_inset LatexCommand \index{standard}
\end_inset
wildcards.
\begin_inset LatexCommand \index{standard wildcards}
\end_inset
\begin_inset LatexCommand \index{wildcards}
\end_inset
This performs
\begin_inset LatexCommand \index{performs}
\end_inset
a logical
\begin_inset LatexCommand \index{logical}
\end_inset
\begin_inset Quotes eld
\end_inset
not
\begin_inset Quotes erd
\end_inset
.
This will match
\begin_inset LatexCommand \index{match}
\end_inset
anything that is not listed
\begin_inset LatexCommand \index{listed}
\end_inset
within those square
\begin_inset LatexCommand \index{square}
\end_inset
brackets.
For example:
\begin_inset LatexCommand \index{example}
\end_inset
\emph on
rm
\begin_inset LatexCommand \index{rm}
\end_inset
myfile[^9]
\emph default
will remove
\begin_inset LatexCommand \index{remove}
\end_inset
all myfiles* (ie.
myfiles1,
\begin_inset LatexCommand \index{myfiles1}
\end_inset
myfiles2
\begin_inset LatexCommand \index{myfiles2}
\end_inset
etc) but won't remove
\begin_inset LatexCommand \index{remove}
\end_inset
a file
\begin_inset LatexCommand \index{file}
\end_inset
with the number
\begin_inset LatexCommand \index{number}
\end_inset
9 anywhere within it's name.
\layout Subsection
\noindent
Useful\SpecialChar ~
categories\SpecialChar ~
of\SpecialChar ~
characters\SpecialChar ~
(as\SpecialChar ~
defined\SpecialChar ~
by\SpecialChar ~
the\SpecialChar ~
POSIX\SpecialChar ~
standard)
\begin_inset LatexCommand \label{useful-posix-characters}
\end_inset
\layout Standard
This information
\begin_inset LatexCommand \index{information}
\end_inset
has been taken
\begin_inset LatexCommand \index{taken}
\end_inset
from the grep
\begin_inset LatexCommand \index{grep}
\end_inset
info
\begin_inset LatexCommand \index{info}
\end_inset
page
\begin_inset LatexCommand \index{page}
\end_inset
with a tiny
\begin_inset LatexCommand \index{tiny}
\end_inset
amount
\begin_inset LatexCommand \index{amount}
\end_inset
of editing,
\begin_inset LatexCommand \index{editing}
\end_inset
see [10] in the
\begin_inset LatexCommand \ref{references}
\end_inset
for further information.
\begin_inset LatexCommand \index{information}
\end_inset
\layout Itemize
[:upper:]
\begin_inset LatexCommand \index{[:upper:]}
\end_inset
upper-case
\begin_inset LatexCommand \index{upper-case}
\end_inset
letters
\layout Itemize
[:lower:]
\begin_inset LatexCommand \index{[:lower:]}
\end_inset
lower-case
\begin_inset LatexCommand \index{lower-case}
\end_inset
letters
\layout Itemize
[:alpha:]
\begin_inset LatexCommand \index{[:alpha:]}
\end_inset
alphabetic
\begin_inset LatexCommand \index{alphabetic}
\end_inset
(letters) meaning
\begin_inset LatexCommand \index{meaning}
\end_inset
upper+lower (both uppercase
\begin_inset LatexCommand \index{uppercase}
\end_inset
and lowercase
\begin_inset LatexCommand \index{lowercase}
\end_inset
letters)
\layout Itemize
[:digit:]
\begin_inset LatexCommand \index{[:digit:]}
\end_inset
numbers
\begin_inset LatexCommand \index{numbers}
\end_inset
in decimal,
\begin_inset LatexCommand \index{decimal}
\end_inset
0 to 9
\layout Itemize
[:alnum:]
\begin_inset LatexCommand \index{[:alnum:]}
\end_inset
alphanumeric
\begin_inset LatexCommand \index{alphanumeric}
\end_inset
meaning alpha+digits (any uppercase
\begin_inset LatexCommand \index{uppercase}
\end_inset
or lowercase
\begin_inset LatexCommand \index{lowercase}
\end_inset
letters
\begin_inset LatexCommand \index{letters}
\end_inset
or any decimal
\begin_inset LatexCommand \index{decimal}
\end_inset
digits)
\layout Itemize
[:space:]
\begin_inset LatexCommand \index{[:space:]}
\end_inset
whitespace
\begin_inset LatexCommand \index{whitespace}
\end_inset
meaning
\begin_inset LatexCommand \index{meaning}
\end_inset
spaces, tabs,
\begin_inset LatexCommand \index{tabs}
\end_inset
newlines
\begin_inset LatexCommand \index{newlines}
\end_inset
and similar
\begin_inset LatexCommand \index{similar}
\end_inset
\layout Itemize
[:graph:]
\begin_inset LatexCommand \index{[:graph:]}
\end_inset
graphically
\begin_inset LatexCommand \index{graphically}
\end_inset
printable
\begin_inset LatexCommand \index{printable}
\end_inset
characters excluding
\begin_inset LatexCommand \index{excluding}
\end_inset
space
\layout Itemize
[:print:]
\begin_inset LatexCommand \index{[:print:]}
\end_inset
printable
\begin_inset LatexCommand \index{printable}
\end_inset
characters including
\begin_inset LatexCommand \index{including}
\end_inset
space
\begin_inset LatexCommand \index{space}
\end_inset
\layout Itemize
[:punct:]
\begin_inset LatexCommand \index{[:punct:]}
\end_inset
punctuation
\begin_inset LatexCommand \index{punctuation}
\end_inset
characters meaning
\begin_inset LatexCommand \index{meaning}
\end_inset
graphical
\begin_inset LatexCommand \index{graphical}
\end_inset
characters minus
\begin_inset LatexCommand \index{minus}
\end_inset
alpha
\begin_inset LatexCommand \index{alpha}
\end_inset
and digits
\begin_inset LatexCommand \index{digits}
\end_inset
\layout Itemize
[:cntrl:]
\begin_inset LatexCommand \index{[:cntrl:]}
\end_inset
control
\begin_inset LatexCommand \index{control}
\end_inset
characters meaning
\begin_inset LatexCommand \index{meaning}
\end_inset
non-printable characters
\begin_inset LatexCommand \index{characters}
\end_inset
\layout Itemize
[:xdigit:]
\begin_inset LatexCommand \index{[:xdigit:]}
\end_inset
characters
\begin_inset LatexCommand \index{characters}
\end_inset
that are hexadecimal
\begin_inset LatexCommand \index{hexadecimal}
\end_inset
digits.
\layout SGML
\layout SGML
These are used with
\layout SGML
\layout SGML
The above commands will work with most tools which work with text (for example:
\emph on
tr
\emph default
).
\layout SGML
\layout SGML
\layout Standard
\noindent
For example
\begin_inset LatexCommand \index{example}
\end_inset
(advanced example)
\emph on
,
\emph default
this command
\begin_inset LatexCommand \index{command}
\end_inset
scans
\begin_inset LatexCommand \index{scans}
\end_inset
the output
\begin_inset LatexCommand \index{output}
\end_inset
of the dir
\begin_inset LatexCommand \index{dir}
\end_inset
command, and prints
\begin_inset LatexCommand \index{prints}
\end_inset
lines
\begin_inset LatexCommand \index{lines}
\end_inset
containing a capital
\begin_inset LatexCommand \index{capital}
\end_inset
letter followed
\begin_inset LatexCommand \index{followed}
\end_inset
by a digit:
\begin_inset LatexCommand \index{digit}
\end_inset
\layout Code
\noindent
ls -l | grep '[[:upper:]][[:digit:]]'
\layout Standard
The command
\begin_inset LatexCommand \index{command}
\end_inset
greps for [upper_case_letter][any_digit], meaning
\begin_inset LatexCommand \index{meaning}
\end_inset
any uppercase
\begin_inset LatexCommand \index{uppercase}
\end_inset
letter
\begin_inset LatexCommand \index{letter}
\end_inset
followed by any digit.
\begin_inset LatexCommand \index{digit}
\end_inset
If you remove the [\SpecialChar ~
] (square brackets) in the middle
\begin_inset LatexCommand \index{middle}
\end_inset
it would look
\begin_inset LatexCommand \index{look}
\end_inset
for an uppercase letter or a digit, because it would become [upper_case_letter\SpecialChar ~
an
y_digit]
\the_end