Difference between revisions of "Help:Reading"

From ArchWiki
Jump to: navigation, search
m (fix category)
(42 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{stub}}
+
[[Category:Help]]
Because the vast majority of the ArchWiki contains indications that may need clarification for users new to GNU/Linux, this rundown of basic procedures was written both to avoid confusion in the assimilation of the articles, and to deter repetition in the content itself.
+
[[es:Help:Reading]]
 
+
{{expansion}}
----
+
  
'''Meta:'''<br>
+
Because the vast majority of the ArchWiki contains indications that may need clarification for users new to GNU/Linux, this rundown of basic procedures was written both to avoid confusion in the assimilation of the articles and to deter repetition in the content itself.
Besides covering basic differentiations, this article could serve to improve the quality of the Wiki by avoiding repetition. How many articles say: "edit in ~/.bashrc, or zhrc (if you're using zsh) -- Alternatively, edit /etc/profile.bash for system-wide changes" or something to that effect? And even though it sounds counterintuitive, expanding this article makes the Wiki ''better for advanced users'' as well, since they won't be presented with the same old information they're accustomed to skip.
+
 
+
We could have a basic run down of common file locations and what they mean, instead of explaining them in every article. As a result, editors can just say "add the following to the shell's configuration" and readers would then decide whether they want it system-wide or not, etc.
+
 
+
Just like article:[[ABS]] is referred to in every page that involves compiling, this page could serve the same kind of utility.
+
 
+
==Regular user or root?==
+
  
 +
==Regular user or root==
 
Some lines are written like so:
 
Some lines are written like so:
  '''#''' pacman -S
+
  '''#''' pacman -S kernel26
 +
 
 
Others have a different prefix:
 
Others have a different prefix:
  '''$''' pacman -S
+
  '''$''' makepkg -s
  
 
The numeral sign ('''#''') indicates that the line is to be entered as ''root'', whereas the dollar sign ('''$''') shows that the line is to be entered as a ''regular user''.
 
The numeral sign ('''#''') indicates that the line is to be entered as ''root'', whereas the dollar sign ('''$''') shows that the line is to be entered as a ''regular user''.
Line 22: Line 16:
 
A notable exception to watch out for:
 
A notable exception to watch out for:
 
  '''#''' This alias makes ls colorize the listing
 
  '''#''' This alias makes ls colorize the listing
  alias ls='ls --color=auto
+
  alias ls='ls --color=auto'
  
In this example, the context surrounding the numeral sign tells the reader that this is not to be ran as a command; it should be edited into a file instead. So in this case, the numeral sign denotes a ''comment''. Bash scripts denotation for comments happens to coincide with the root ''PS1''.
+
In this example, the context surrounding the numeral sign communicates that this is not to be run as a command; it should be edited into a file instead. So in this case, the numeral sign denotes a ''comment''. A comment can be explanatory text that will not be interpreted by the associated program. [[Bash]] scripts denotation for comments happens to coincide with the root ''PS1''.
  
After further examination, "give away" signs include the uppercase character after the '''#''' sign. Usually, Unix are not written this way, and most of the time they are short abbreviations instead of full-blown English words (e.g. Copy=cp).
+
After further examination, "give away" signs include the uppercase character following the '''#''' sign. Usually, Unix commands are not written this way and most of the time they are short abbreviations instead of full-blown English words (e.g., ''Copy'' becomes {{ic|cp}}).
  
 
Regardless, most articles make this easy to discern by notifying the reader:
 
Regardless, most articles make this easy to discern by notifying the reader:
  
'''Append''' to {{Filename|~/path/to/file}}:
+
''Append'' to {{ic|~/path/to/file}}:
  # This alias makes ls assign to the listing
+
  # This alias makes ls colorize the listing
 
  alias ls='ls --color=auto
 
  alias ls='ls --color=auto
  
==Personal settings or system-wide?==
+
==''Append'', ''create'', ''edit'' and ''source''==
<small>To do...</small>
+
When prompted to ''append'', ''add'', ''create'' or ''edit'', consider it an indication for using a text editor, such as [[nano]], in order to make changes to configuration file(s):
 +
# nano /etc/bash.bashrc
  
[[Category:Help]]
+
In programs, be it shells or otherwise, ''sourcing'' applies settings specified in a file. For Bash, sourcing can be done in a command prompt:
[[Category:HOWTOs (English)]]
+
$ source /etc/bash.bashrc
 +
and it can also happen in a file itself:
 +
# This line includes settings from another file
 +
source /etc/bash.bashrc
 +
As a result, sourcing a file after alteration is an ''implied omission'' in the case of shell files.
 +
 
 +
However, not all articles will specify the nature of the changes to be made, nor ''which'' file to alter in the first place. This wiki builds-up on previous knowledge, such as common locations for files that are prone to sporadic editing.
 +
 
 +
==System-wide versus user-specific configuration==
 +
It is important to remember that there are two different kinds of configurations on a GNU/Linux system. '''System-wide''' configuration affects all users. Since system-wide settings are generally located in the {{ic|/etc}} directory, root privileges are required in order to alter them. E.g., to apply a Bash setting that affects all users, {{ic|/etc/bash.bashrc}} should be modified.
 +
 
 +
'''User-specific''' configuration affects only a single user. ''Dotfiles'' are used for user-specific configuration. For example, the file {{ic|~/'''.'''bashrc}} is the user-specific configuration file. The idea is that each user can define their own settings, such as aliases, functions and other interactive features like the prompt, without affecting other users' preferences.
 +
 
 +
{{Note|{{ic|~/}} is a shortcut for the user's home directory, usually {{ic|/home/''username''/}}.}}
 +
 
 +
===Common shell files===
 +
For ease of use, here is a selective listing of basic configuration files and their locations.
 +
 
 +
====Bash====
 +
''See also: [[Bash]] and {{ic|man bash}}''
 +
 
 +
Within Bash and other bourne-compatible shells, such as [[Zsh]], there is even further differentiation in the purposes of the configuration files. Some files only get sourced when Bash is starting as a ''login shell'', whereas other files only do so when Bash is an ''interactive shell''.
 +
 
 +
When Bash is run in a ''virtual console'', for instance, it is started as a login shell. Bash shells started in a [[Xorg]] session, such as those employed by [[xterm]], are interactive shells.
 +
 
 +
Common files:
 +
 
 +
;{{ic|/etc/bash.bashrc}} : System-wide settings; sourced only by a login shell
 +
 
 +
;{{ic|~/.bashrc}} : Personal shell settings; sourced only by an interactive shell
 +
 
 +
====Zsh====
 +
''See also: [[Zsh]] and {{ic|man zsh}}''
 +
 
 +
Common files:
 +
 
 +
;{{ic|/etc/zprofile}} : System-wide settings; sourced only by a login shell
 +
 
 +
;{{ic|~/.zshrc}} : Personal shell settings; sourced only by an interactive shell
 +
 
 +
==Closing notes==
 +
Recurring procedures include:
 +
*working with [[pacman]];
 +
*using the [[AUR]]; and
 +
*adding [[daemons]].

Revision as of 19:05, 13 June 2012

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Help talk:Reading#)

Because the vast majority of the ArchWiki contains indications that may need clarification for users new to GNU/Linux, this rundown of basic procedures was written both to avoid confusion in the assimilation of the articles and to deter repetition in the content itself.

Regular user or root

Some lines are written like so:

# pacman -S kernel26

Others have a different prefix:

$ makepkg -s

The numeral sign (#) indicates that the line is to be entered as root, whereas the dollar sign ($) shows that the line is to be entered as a regular user.

A notable exception to watch out for:

# This alias makes ls colorize the listing
alias ls='ls --color=auto'

In this example, the context surrounding the numeral sign communicates that this is not to be run as a command; it should be edited into a file instead. So in this case, the numeral sign denotes a comment. A comment can be explanatory text that will not be interpreted by the associated program. Bash scripts denotation for comments happens to coincide with the root PS1.

After further examination, "give away" signs include the uppercase character following the # sign. Usually, Unix commands are not written this way and most of the time they are short abbreviations instead of full-blown English words (e.g., Copy becomes cp).

Regardless, most articles make this easy to discern by notifying the reader:

Append to ~/path/to/file:

# This alias makes ls colorize the listing
alias ls='ls --color=auto

Append, create, edit and source

When prompted to append, add, create or edit, consider it an indication for using a text editor, such as nano, in order to make changes to configuration file(s):

# nano /etc/bash.bashrc

In programs, be it shells or otherwise, sourcing applies settings specified in a file. For Bash, sourcing can be done in a command prompt:

$ source /etc/bash.bashrc

and it can also happen in a file itself:

# This line includes settings from another file
source /etc/bash.bashrc

As a result, sourcing a file after alteration is an implied omission in the case of shell files.

However, not all articles will specify the nature of the changes to be made, nor which file to alter in the first place. This wiki builds-up on previous knowledge, such as common locations for files that are prone to sporadic editing.

System-wide versus user-specific configuration

It is important to remember that there are two different kinds of configurations on a GNU/Linux system. System-wide configuration affects all users. Since system-wide settings are generally located in the /etc directory, root privileges are required in order to alter them. E.g., to apply a Bash setting that affects all users, /etc/bash.bashrc should be modified.

User-specific configuration affects only a single user. Dotfiles are used for user-specific configuration. For example, the file ~/.bashrc is the user-specific configuration file. The idea is that each user can define their own settings, such as aliases, functions and other interactive features like the prompt, without affecting other users' preferences.

Note: ~/ is a shortcut for the user's home directory, usually /home/username/.

Common shell files

For ease of use, here is a selective listing of basic configuration files and their locations.

Bash

See also: Bash and man bash

Within Bash and other bourne-compatible shells, such as Zsh, there is even further differentiation in the purposes of the configuration files. Some files only get sourced when Bash is starting as a login shell, whereas other files only do so when Bash is an interactive shell.

When Bash is run in a virtual console, for instance, it is started as a login shell. Bash shells started in a Xorg session, such as those employed by xterm, are interactive shells.

Common files:

/etc/bash.bashrc 
System-wide settings; sourced only by a login shell
~/.bashrc 
Personal shell settings; sourced only by an interactive shell

Zsh

See also: Zsh and man zsh

Common files:

/etc/zprofile 
System-wide settings; sourced only by a login shell
~/.zshrc 
Personal shell settings; sourced only by an interactive shell

Closing notes

Recurring procedures include: