[2025-jun-17] The SlackDocs mailing lists at https://lists.alienbase.nl/mailman/listinfo have been retired. No one has been using these lists for years and it's time to say goodbye. The list archives remain available at https://scalzi.slackware.nl/mailman/listinfo/slackdocs
[2025-jun-17] The SlackDocs Wiki has moved to a new server, in order to make it more performant.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howtos:general_admin:cli_constructs_and_useful_info [2012/10/21 07:29 (UTC)] – [Regex] htexmexh | howtos:general_admin:cli_constructs_and_useful_info [2013/04/02 15:19 (UTC)] (current) – [Constructs] htexmexh | ||
---|---|---|---|
Line 9: | Line 9: | ||
ls -1 / | ls -1 / | ||
</ | </ | ||
- | Or if you wanted to get the full patch of a file, minus the suffix. | + | Or if you wanted to get the full path of a file, minus the suffix. |
<code bash> | <code bash> | ||
echo / | echo / | ||
Line 78: | Line 78: | ||
</ | </ | ||
Note that there are no quotes around '' | Note that there are no quotes around '' | ||
+ | == External Links === | ||
+ | * http:// | ||
==== Quoting ==== | ==== Quoting ==== | ||
Quoting may seem complicated, | Quoting may seem complicated, | ||
Line 95: | Line 97: | ||
bash-4.2$ | bash-4.2$ | ||
</ | </ | ||
- | Clearly you need to quote a file with spaces. You could use single quotes here, because no variable | + | Clearly you need to quote a file with spaces. You could use single quotes here, because no variables |
<code bash> | <code bash> | ||
bash-4.2$ for i in $(seq 1 10); do printf "$i "; done; echo; | bash-4.2$ for i in $(seq 1 10); do printf "$i "; done; echo; | ||
Line 144: | Line 146: | ||
</ | </ | ||
Here the shell expands '' | Here the shell expands '' | ||
- | ==== Basic and Extended Regex ==== | + | === External Links === |
+ | * http:// | ||
+ | ==== Regular expressions ==== | ||
+ | === Basic === | ||
* '' | * '' | ||
* '' | * '' | ||
Line 162: | Line 167: | ||
* '' | * '' | ||
* '' | * '' | ||
- | * '' | + | * '' |
* '' | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * Example: '' | ||
+ | * '' | ||
+ | === Extended regular expressions === | ||
+ | The following must be supported by the program for them to work. For example for grep you must run '' | ||
+ | * '' | ||
+ | * ''?'' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | === External Links === | ||
+ | * http:// | ||
+ | * http:// | ||
+ | ==== Useful commands and info ==== | ||
+ | === stat === | ||
+ | Stat is the most accurate way to determine: | ||
+ | * File size in bytes: <code bash> | ||
+ | * File permissions in octal: <code bash> | ||
+ | === awk variable defaults === | ||
+ | An important point is that awk variables are set to zero by default. This may cause problems in some situtations. Example: | ||
+ | <code bash> | ||
+ | echo -ne ' | ||
+ | </ | ||
+ | This works properly because max is set to an empty string and thus has a lower value than any number. Try removing the BEGIN clause and see what happens. Also note that adding '' | ||
+ | === no data directory test === | ||
+ | You can use this to test if a directory contains no data. For example, it will say '' | ||
+ | <code bash> | ||
+ | du -s directory | ||
+ | </ | ||
+ | === cmp === | ||
+ | This can compare two files byte by byte, and can be more useful than checksums. For example, after you burn a CD/DVD, you can run: | ||
+ | <code bash> | ||
+ | cmp slackware.iso /dev/sr0 | ||
+ | </ | ||
+ | It should say the following if the disk burned correctly: | ||
+ | <code bash> | ||
+ | cmp: EOF on slackware.iso | ||
+ | </ | ||
+ | === shell math === | ||
+ | Remember that shell utilities like '' | ||
+ | === shell GUI === | ||
+ | There are numerous programs that allow you to create GUIs from a shell script. | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | === External Links === | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
====== Sources ====== | ====== Sources ====== | ||
<!-- If you are copying information from another source, then specify that source --> | <!-- If you are copying information from another source, then specify that source --> | ||
Line 170: | Line 230: | ||
<!-- * Originally written by [[wiki: | <!-- * Originally written by [[wiki: | ||
<!-- * Contributions by [[wiki: | <!-- * Contributions by [[wiki: | ||
+ | * I quoted '' | ||
+ | * I used '' | ||
+ | * Written by [[wiki: | ||
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> | ||
<!-- You must remove the tag-word " | <!-- You must remove the tag-word " | ||
- | {{tag> | + | {{tag> |