[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
slackbook:shell [2012/09/08 11:00 (UTC)] – [tar] updated to match original article including formatting mfillpotslackbook:shell [2014/05/21 08:39 (UTC)] (current) – [File and Directory Creation and Deletion] man -> mkdir zithro
Line 15: Line 15:
 (short for **manual**) will bring up the included (short for **manual**) will bring up the included
 man-page for any application, system call, configuration file, or man-page for any application, system call, configuration file, or
-library you tell it too.  For example, man man+library you tell it too.  For example, **man man**
 will bring up the man-page for **//man//** itself. will bring up the man-page for **//man//** itself.
  
Line 196: Line 196:
 "/slack", then "/slack/foo", and finally "/slack/foo/bar" If you "/slack", then "/slack/foo", and finally "/slack/foo/bar" If you
 failed to use the //-p// argument, failed to use the //-p// argument,
-**//man//** would fail to create "/slack/foo/bar"+**//mkdir//** would fail to create "/slack/foo/bar"
 unless the first two already existed, as you saw in the example. unless the first two already existed, as you saw in the example.
  
Line 328: Line 328:
 strength. Unfortunately, achieving that greater compression is a slow strength. Unfortunately, achieving that greater compression is a slow
 and CPU-intensive process, so **//bzip2//**  and CPU-intensive process, so **//bzip2//** 
-typicall takes much longer to run than other alternatives.+typically takes much longer to run than other alternatives.
 ==== XZ / LZMA ==== ==== XZ / LZMA ====
  
  
 The latest compression utility added to Slackware is The latest compression utility added to Slackware is
-**//xz//**, which impliments the LZMA compression+**//xz//**, which implements the LZMA compression
 algorithm. This is faster than **//bzip2//** and algorithm. This is faster than **//bzip2//** and
 often compresses better as well. In fact, its blend of speed and often compresses better as well. In fact, its blend of speed and
 compression strength caused it to replace compression strength caused it to replace
 **//gzip//** as the compression scheme of choice for **//gzip//** as the compression scheme of choice for
-Slackware.  Unfortuantely, **//xz//** does not have+Slackware.  Unfortunately, **//xz//** does not have
 a man page at the time of this writing, so to view available options, a man page at the time of this writing, so to view available options,
 use the //--help// argument.  Compressing files is accomplished use the //--help// argument.  Compressing files is accomplished
Line 411: Line 411:
 ===== Reading Documents ===== ===== Reading Documents =====
  
-Traditionally, UNIX and UNIX-like operating systems are filled with text files that at some point in time the system's users are going to want to read. Naturally, there are plenty of ways of reading these files, and we'll show you the most common ones.+Traditionally, UNIX and UNIX-like operating systems are filled with 
 +text files that at some point in time the system's users are going to 
 +want to read.  Naturally, there are plenty of ways of reading these 
 +files, and we'll show you the most common ones.
  
-In the early days, if you just wanted to see the contents of a file (any file, whether it was a text file or some binary program) you would use cat(1) to view them. cat is a very simple program, which takes one or more files, concatenates them (hence the name) and sends them to the standard output, which is usually your terminal screen. This was fine when the file was small and wouldn't scroll off the screen, but inadequate for larger files as it had no built-in way of moving within a document and reading it a paragraph at a time. Today, cat is still used quite extensively, but predominately in scripts or for joining two or more files into one. 
  
-  darkstar:~$ cat /etc/slackware-version +In the early days, if you just wanted to see the contents of a file 
-  Slackware 12.0.0+(any file, whether it was a text file or some binary program) you would 
 +use **//cat//**(1) to view them. 
 +**//cat//** is a very simple program, which takes 
 +one or more files, concatenates them (hence the name) and sends them to 
 +the standard output, which is usually your terminal screen.  This was 
 +fine when the file was small and wouldn't scroll off the screen, but 
 +inadequate for larger files as it had no built-in way of moving within 
 +a document and reading it a paragraph at a time Today, 
 +**//cat//** is still used quite extensively, but 
 +predominately in scripts or for joining two or more files into one.
  
-Given the limitations of cat some very intelligent people sat down and began to work on an application to let them read documents one page at a time. Naturally, such applications began to be known as "pagers". One of the earliest of these was more(1), named because it would let you see "more" of the file whenever you wanted. 
  
 +<code>
 +darkstar:~$ cat /etc/slackware-version
 +Slackware 14.0
 +</code>
 +
 +
 +Given the limitations of **//cat//** some very
 +intelligent people sat down and began to work on an application to let
 +them read documents one page at a time.  Naturally, such applications
 +began to be known as "pagers" One of the earliest of these was
 +**//more//**(1), named because it would let you see
 +"more" of the file whenever you wanted.
 ==== more ==== ==== more ====
  
-more will display the first few lines of a text file until your screen is full, then pause. Once you've read through that screen, you can proceed down one line by pressing **ENTER**, or an entire screen by pressing **SPACE**, or by a specified number of lines by typing a number and then the **SPACE** bar. more is also capable of searching through a text file for keywords; once you've displayed a file in more, press the / key and enter a keyword. Upon pressing **ENTER**, the text will scroll until it finds the next match.+**//more//** will display the first few lines of a 
 +text file until your screen is full, then pause.  Once you've read 
 +through that screen, you can proceed down one line by pressing <key>'ENTER'</key>, 
 +or an entire screen by pressing <key>'SPACE'</key>, or by a 
 +specified number of lines by typing a number and then the 
 +<key>'SPACE'</key> bar. **//more//** is also 
 +capable of searching through a text file for keywords; once you've 
 +displayed a file in **//more//**, press the / 
 +key and enter a keyword.  Upon pressing <key>'ENTER'</key>, the 
 +text will scroll until it finds the next match.  
  
-This is clearly a big improvement over cat, but still suffers from some annoying flaws; more is not able to scroll back up through a piped file to allow you to read something you might have missed, the search function does not highlight its results, there is no horizontal scrolling, and so on. Clearly a better solution is possible. 
  
 +This is clearly a big improvement over
 +**//cat//**, but still suffers from some annoying
 +flaws; **//more//** is not able to scroll back up
 +through a piped file to allow you to read something you might have
 +missed, the search function does not highlight its results, there is
 +no horizontal scrolling, and so on.  Clearly a better solution is
 +possible.
  
-<note>In fact, modern versions of more, such as the one shipped with Slackware, do feature a back function via the b key. However, the function is only available when opening files directly in more; not when a file is piped to more.</note> 
  
 +<note>
 +  
 +In fact, modern versions of **//more//**, such
 +as the one shipped with Slackware, do feature a
 +**back** function via the <key>'b'</key>
 +key. However, the function is only available when opening files
 +directly in **//more//**; not when a file is
 +piped to **//more//**.
 +
 +</note>
 ==== less ==== ==== less ====
  
-In order to address the short-comings of more, a new pager was developed and ironically dubbed less(1). less is a very powerful pager that supports all of the functions of more while adding lots of additional features. To begin with, less allows you to use your arrow keys to control movement within the document.+In order to address the short-comings of 
 +**//more//**, a new pager was developed and 
 +ironically dubbed **//less//**(1). 
 +**//less//** is a very powerful pager that 
 +supports all of the functions of **//more//** 
 +while adding lots of additional features.  To begin with, 
 +**//less//** allows you to use your arrow keys to 
 +control movement within the document.
  
-Due to its popularity, many Linux distributions have begun to exclude more in favor of less. Slackware includes both. Moreover, Slackware also includes a handy little pre-processor for less called lesspipe.sh. This allows a user to exectute less on a number of non-text files. lesspipe.sh will generate text output from running a command on these files, and display it in less. 
  
-Less provides nearly as much functionality as one might expect from a text editor without actually being a text editor. Movement line-by-line can be done vi-style with **j** and **k**, or with the arrow keys, or **ENTER**. In the event that file is too wide to fit on one screen, you can even scroll horizontally with the left and right arrow keys. The g key takes you to the top of the filewhile G takes you to the end.+Due to its popularity, many Linux distributions have begun to 
 +exclude **//more//** in favor of 
 +**//less//**.  Slackware includes both. 
 +MoreoverSlackware also includes a handy little pre-processor for 
 +**//less//** called 
 +''lesspipe.sh'' This allows user to execute 
 +**//less//** on a number of non-text files. 
 +''lesspipe.sh'' will generate text output from 
 +running a command on these filesand display it in 
 +**//less//**.
  
-Searching is done as with more, by typing the / key and then your search string, but notice how the search results are highlighted for you, and typing n will take you to the next occurence of the result while N takes you to the previous occurrence. 
  
-Also as with morefiles maybe opened directly in less or piped to it:+**//Less//** provides nearly as much 
 +functionality as one might expect from a text editor without 
 +actually being a text editor. Movement line-by-line can be done 
 +**//vi//**-style with <key>'j'</key> and 
 +<key>'k'</key>, or with the arrow keys, or 
 +<key>'ENTER'</key>. In the event that a file is too wide to fit 
 +on one screen, you can even scroll horizontally with the left and 
 +right arrow keys. The <key>'g'</key> key takes you to the top of 
 +the file, while <key>'G'</key> takes you to the 
 +end.
  
-  darkstar:~$  less 
-  /usr/doc/less-*/README 
-  darkstar:~$  cat 
-  /usr/doc/less*/README 
-  /usr/doc/util-linux*/README | less 
  
-There is much more to less; from within the application, type **h** for a full list of commands+Searching is done as with **//more//**, by typing 
 +the / key and then your search string, but notice how the search 
 +results are highlighted for you, and typing <key>'n'</key> will 
 +take you to the next occurrence of the result while 
 +<key>'N'</key> takes you to the previous occurrence.
  
 +
 +Also as with **//more//**, files may be opened
 +directly in **//less//** or piped to it:
 +
 +
 +<code>
 +
 +darkstar:~$  less
 +/usr/doc/less:/README
 +darkstar:~$  cat
 +/usr/doc/less:/README
 +/usr/doc/util-linux:/README | less
 +</code>
 +
 +
 +There is much more to **//less//**; from within
 +the application, type <key>'h'</key> for a full list of
 +commands. 
 ===== Linking ===== ===== Linking =====
  
-Links are a method of referring to one file by more than one name. By using the ln(1) application, a user can reference one file with more than one name. The two files are not carbon-copies of one another, but rather are the exact same file, just with a different name. To remove the file entirely, all of its names must be deleted. (This is actually the result of the way that rm and other tools like it work. Rather than remove the contents of the file, they simply remove the reference to the file, freeing that space to be re-used. ln will create a second reference or "link" to that file.)+Links are a method of referring to one file by more than one name.  By 
 +using the **//ln//**(1) application, a user can 
 +reference one file with more than one name.  The two files are not 
 +carbon-copies of one another, but rather are the exact same file, just 
 +with a different name.  To remove the file entirely, all of its names 
 +must be deleted.  (This is actually the result of the way that 
 +**//rm//** and other tools like it work.  Rather 
 +than remove the contents of the file, they simply remove the reference 
 +to the file, freeing that space to be re-used. 
 +**//ln//** will create a second reference or "link" 
 +to that file.)
  
-  darkstar:~$ ln /etc/slackware-version foo 
-  darkstar:~$ cat foo 
-  Slackware 12.0.0 
-  darkstar:~$ ls -l /etc/slackware-version foo 
-  -rw-r--r-- 1 root root 17 2007-06-10 02:23 /etc/slackware-version 
-  -rw-r--r-- 1 root root 17 2007-06-10 02:23 foo 
  
-Another type of link exists, the symlink. Symlinks, rather than being another reference to the same file, are actually a special kind of file in their own right. These symlinks point to another file or directory. The primary advantage of symlinks is that they can refer to directories as well as files, and they can span multiple filesystems. These are created with the [-s] argument.+<code> 
 +darkstar:~$ ln /etc/slackware-version foo 
 +darkstar:~$ cat foo 
 +Slackware 14.
 +darkstar:~$ ls -l /etc/slackware-version foo 
 +-rw-r--r-- 1 root root 17 2007-06-10 02:23 /etc/slackware-version 
 +-rw-r--r-- 1 root root 17 2007-06-10 02:23 foo 
 +</code>
  
-  darkstar:~$ ln -s /etc/slackware-version foo 
-  darkstar:~$ cat foo 
-  Slackware 12.0.0 
-  darkstar:~$ ls -l /etc/slackware-version foo 
-  -rw-r--r-- 1 root root 17 2007-06-10 02:23 /etc/slackware-version 
-  lrwxrwxrwx 1 root root 22 2008-01-25 04:16 foo -> /etc/slackware-version 
  
-When using symlinksremember that if the original file is deletedyour symlink is useless; it simply points at a file that doesn't exist anymore+Another type of link exists, the symlink.  Symlinks, rather than being 
 +another reference to the same file, are actually special kind of file 
 +in their own right.  These symlinks point to another file or directory. 
 +The primary advantage of symlinks is that they can refer to directories 
 +as well as files, and they can span multiple filesystems.  These are 
 +created with the //-s// argument. 
 + 
 + 
 +<code> 
 +darkstar:~$ ln -s /etc/slackware-version foo 
 +darkstar:~$ cat foo 
 +Slackware 140 
 +darkstar:~$ ls -l /etc/slackware-version foo 
 +-rw-r--r-- 1 root root 17 2007-06-10 02:23 /etc/slackware-version 
 +lrwxrwxrwx 1 root root 22 2008-01-25 04:16 foo -> /etc/slackware-version 
 +</code> 
  
-----+When using symlinks, remember that if the original file is deleted, 
 +your symlink is useless; it simply points at a file that doesn't exist 
 +anymore. 
 +====== Chapter Navigation ======
  
 **Previous Chapter: [[slackbook:booting|Booting]]** **Previous Chapter: [[slackbook:booting|Booting]]**
Line 478: Line 588:
 ====== Sources ====== ====== Sources ======
 <!-- If you copy information from another source, then specify that source --> <!-- If you copy information from another source, then specify that source -->
- * Original source: [[http://www.slackbook.org/beta]] \\+  * Original source: [[http://www.slackbook.org/beta]] \\
 <!-- Authors are allowed to give credit to themselves! --> <!-- Authors are allowed to give credit to themselves! -->
- * Originally written by Alan Hicks, Chris Lumens, David Cantrell, Logan Johnson+  * Originally written by Alan Hicks, Chris Lumens, David Cantrell, Logan Johnson
 <!-- * Contrbutions by [[wiki:user:yyy | User Y]] --> <!-- * Contrbutions by [[wiki:user:yyy | User Y]] -->
  
 slackbook:shell ()