Difference between revisions of "Help:Reading"

From ArchWiki
Jump to: navigation, search
m (moved inline comment to talk page)
(consistency, added some files, removed sudo: see [[Talk:Help:Reading]])
Line 1: Line 1:
 +
[[Category:Help]]
 +
[[Category:HOWTOs (English)]]
 
{{stub}}
 
{{stub}}
 
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.
 
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?==
+
==Regular user or root==
  
 
Some lines are written like so:
 
Some lines are written like so:
 
+
  '''#''' pacman -S kernel26
  '''#''' pacman -S
+
  
 
Others have a different prefix:
 
Others have a different prefix:
 
+
  '''$''' pacman -S kernel26
  '''$''' pacman -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''.
  
 
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 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''.
  
After further examination, "give away" signs include the uppercase character after 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=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 {{Codeline|cp}}).
  
Regardless, most articles make this easy to discern by notifying the reader:
+
Comments are sections of code/configuration files that are not recognized by the associated program; their purpose is only to aid the coder/reader in interpreting the code.
  
'''Append''' to {{Filename|~/path/to/file}}:
+
Regardless, most articles make this easy to discern by notifying the reader:
  
 +
''Append'' to {{Filename|~/path/to/file}}:
 
  # This alias makes ls colorize the listing
 
  # This alias makes ls colorize the listing
 
  alias ls='ls --color=auto
 
  alias ls='ls --color=auto
  
===Sudo===
+
==''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
  
When you see a command prefixed with [[sudo]], it means that you need to have sudo installed and configured in order to use sudo. Or run the command as root.
+
''Sourcing'' a file is a way of applying changes (stated in a configuration file) to the shell, be it [[Bash]] or otherwise. Sourcing a file 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
  
Using sudo:
+
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.
  
$ sudo pacman -Syu
+
==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 {{Filename|/etc}} directory,root privileges are required in order to alter them. If settings are to be applied to all users, make the changes in {{Filename|/etc}}. E.g., To apply a Bash setting that affects all users, {{Filename|/etc/bash.bashrc}} should be modified.
  
Same command without sudo:
+
'''User-specific''' configuration affects only a single user. ''Dotfiles'' are used for user-specific configuration. For example, the file {{Filename|~/'''.'''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.
  
# pacman -Syu
+
{{Note| ~/ is a shortcut for the user's home directory, usually {{Filename|/home/''username''/}}.}}
  
==System-Wide vs. User-Specific Configuration==
+
===Common configuration files===
 +
For ease of use, here is a selective listing of basic configuration files and their locations.
  
It's important to remember that there are two different kinds of configurations on a Linux system. System-Wide configuration affects all users. System-Wide settings are generally made/located in the /etc directory, so you must be root in order to change System-Wide settings or using sudo. Since you want these settings to apply to all users, you make the changes in /etc. Some configuration files in /etc include: /etc/bash.bashrc, /etc/fstab, /etc/hosts and /etc/X11/xorg.conf. In fact, nearly all the files in /etc are configuration files.
+
====Bash====
 +
Within Bash and other bourne-compatible shells, such as [[zsh]], there is even further diffirentiation in the purposes of the different 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''.
  
User-Specific configuration affects only a single user. Dotfiles are used for User-Specific configuration. For example, the file ~/.bashrc is the User-Specific per-interactive-shell startup file. This will be different for every user on the system, so each user has their own .bashrc file in their home directory. This allows each user to define: aliases, functions and other interactive features like the prompt.
+
When Bash is run in a ''virtual console'', for instance, it is started as a login shell. Bash instances started in a [[Xorg]] session, such as those employed by [[xterm]], are interactive shells.
  
So when you see that System-Wide, Systemwide is mentioned it affects all users. And when you see that User-Specific, Per-User is mentioned it only affects a single user.
+
<small>''See also: [[Bash]] and {{Codeline|man bash}}''</small>
  
{{Note| ~/ is a shortcut for the user's home directory /home/user-name/, that is currently logged in.}}
+
;{{Filename|/etc/bash.bashrc : System-wide settings; sourced only by a login shell
  
==Add, Create & Edit==
+
;{{Filename|~/.bashrc}} : Personal shell settings; sourced only by an interactive shell
 
+
Whenever you see the words add, create and edit. It simply means to use your favorite text editor to make changes to a configuration file(s). For example [[emacs]], [[nano]], [[vim]]. I suggest starting with nano if you don't have a favorite text editor or don't know how to use the others. When you are ready start using a more powerful text editor like the ones mentioned above, editing configuration file(s) will be faster.
+
 
+
[[Category:Help]]
+
[[Category:HOWTOs (English)]]
+

Revision as of 18:40, 12 November 2009

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (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:

$ pacman -S kernel26

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 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.

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 Template:Codeline).

Comments are sections of code/configuration files that are not recognized by the associated program; their purpose is only to aid the coder/reader in interpreting the code.

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

Append to Template:Filename:

# 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

Sourcing a file is a way of applying changes (stated in a configuration file) to the shell, be it Bash or otherwise. Sourcing a file 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

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 Template:Filename directory,root privileges are required in order to alter them. If settings are to be applied to all users, make the changes in Template:Filename. E.g., To apply a Bash setting that affects all users, Template:Filename should be modified.

User-specific configuration affects only a single user. Dotfiles are used for user-specific configuration. For example, the file Template:Filename 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 Template:Filename.

Common configuration files

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

Bash

Within Bash and other bourne-compatible shells, such as zsh, there is even further diffirentiation in the purposes of the different 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 instances started in a Xorg session, such as those employed by xterm, are interactive shells.

See also: Bash and Template:Codeline

{{Filename|/etc/bash.bashrc 
System-wide settings; sourced only by a login shell
Template:Filename 
Personal shell settings; sourced only by an interactive shell