https://wiki.archlinux.org/api.php?action=feedcontributions&user=Enoksrd&feedformat=atomArchWiki - User contributions [en]2024-03-28T18:20:07ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Man_page&diff=195297Man page2012-04-20T01:42:53Z<p>Enoksrd: /* Colored man pages on xterm or rxvt-unicode */ Added info and get bold/underline and colors at the same time. I've been wondering how to do this for literally 8 years ... should have read the man page carefully earlier :P</p>
<hr />
<div>[[Category:Software (English)]]<br />
{{i18n|Man Page}}<br />
<br />
{{Article summary start|Summary}}<br />
{{Article summary text|Information on man pages, along with recommendations on how to improve their usage}}<br />
<!--<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|}}<br />
--><br />
{{Article summary end}}<br />
<br />
'''Man pages''' (abbreviation for "manual pages") are the extensive documentation that comes preinstalled with almost all substantial UNIX-like operating systems, including Arch Linux. The command used to display them is {{Ic|man}}.<br />
<br />
In spite of their scope, man pages are designed to be self-contained documents, consequentially limiting themselves to referring to other man pages when discussing related subjects. This is in sharp contrast with the hyperlink-aware info files, GNU's attempt at replacing the traditional man page format.<br />
<br />
==Accessing Man Pages==<br />
To read a man page, simply enter:<br />
<br />
$ man ''page_name''<br />
<br />
Manuals are sorted into several sections:<br />
# General commands<br />
# System calls (functions provided by the kernel)<br />
# Library calls (C library functions)<br />
# Special files (usually found in /dev) and drivers<br />
# File formats and conventions<br />
# Games<br />
# Miscellaneous (including conventions)<br />
# System administration commands (usually requiring root privileges) and daemons<br />
<br />
Man pages are usually referred to by their name, followed by their section number in parentheses. Often there are multiple man pages of the same name, such as man(1) and man(7). In this case, give man the section number followed by the name of the man page, for example:<br />
<br />
$ man 5 passwd<br />
<br />
to read the man page on {{Ic|/etc/passwd}}, rather than the {{Ic|passwd}} utility.<br />
<br />
Very brief descriptions of programs can be read out of man pages without displaying the whole page using the {{Ic|whatis}} command. For example, for a brief description of ls, type:<br />
<br />
$ whatis ls<br />
<br />
and {{Ic|whatis}} will output "list directory contents."<br />
<br />
==Format==<br />
Man pages all follow a fairly standard format, which helps in navigating them. Some sections which are often present include:<br />
* NAME - The name of the command and a one-line statement of its purpose.<br />
* SYNOPSIS - A list of the options and arguments a command takes or the parameters the function takes and its header file.<br />
* DESCRIPTION - A more in depth description of a command or function's purpose and workings.<br />
* EXAMPLES - Common examples, usually ranging from the simple to the relatively complex.<br />
* OPTIONS - Descriptions of each of the options a command takes and what they do.<br />
* EXIT STATUS - The meanings of different exit codes.<br />
* FILES - Files related to a command or function.<br />
* BUGS - Problems with the command or function that are pending repair. Also known as KNOWN BUGS.<br />
* SEE ALSO - A list of related commands or functions.<br />
* AUTHOR, HISTORY, COPYRIGHT, LICENSE, WARRANTY - Information about the program, its past, its terms of use, and its creator.<br />
<br />
==Searching manuals==<br />
Whilst the {{Ic|man}} utility allows users to display man pages, a problem arises when one knows not the exact name of the desired manual page in the first place! Fortunately, the {{Ic|-k}} or {{Ic|--apropos}} options can be used to search the manual page descriptions for instances of a given keyword. For example, to search for man pages related to "password":<br />
<br />
$ man -k password<br />
<br />
or:<br />
<br />
$ man --apropos password<br />
<br />
This is equivalent to calling the {{Ic|apropos}} command:<br />
<br />
$ apropos password<br />
<br />
The given keyword is interpreted as a regular expression by default.<br />
<br />
==Colored man pages==<br />
For some users, color-enabled man pages allow for a clearer presentation and easier digestion of the content. Given that users new to Linux are prone to spend a considerable amount of time familiarizing themselves with basic userspace tools, setting up a comfortable environment is a necessity to most.<br />
<br />
There are two prevalent methods for achieving colored man pages: using {{Ic|most}}, or opting for {{Ic|less}}. The former is simpler to configure, at the expense of the advanced functionality that is native to {{Ic|less}}.<br />
<br />
===First method: using 'most'===<br />
Install {{Pkg|most}} using [[pacman]]:<br />
# pacman -S most<br />
This is similar to {{Ic|less}} and {{Ic|more}}, yet allows rendering colored text in an easier way.<br />
<br />
Edit {{ic|/etc/man_db.conf}}, uncomment the pager definition and change it to:<br />
DEFINE pager most -s<br />
Test the new setup by typing:<br />
$ man whatever_man_page<br />
<br />
Modifying the color values requires editing {{ic|~/.mostrc}} (creating the file if it is not present) or editing {{ic|/etc/most.conf}} for system-wide changes. Example {{ic|~/.mostrc}}:<br />
% Color settings<br />
color normal lightgray black<br />
color status yellow blue<br />
color underline yellow black<br />
color overstrike brightblue black<br />
Another example showing keybindings similar to {{Ic|less}} (jump to line is set to 'J'):<br />
% less-like keybindings<br />
unsetkey "^K"<br />
unsetkey "g"<br />
unsetkey "G"<br />
unsetkey ":"<br />
<br />
setkey next_file ":n"<br />
setkey find_file ":e"<br />
setkey next_file ":p"<br />
setkey toggle_options ":o"<br />
setkey toggle_case ":c"<br />
setkey delete_file ":d"<br />
setkey exit ":q"<br />
<br />
setkey bob "g"<br />
setkey eob "G"<br />
setkey down "e"<br />
setkey down "E"<br />
setkey down "j"<br />
setkey down "^N"<br />
setkey up "y"<br />
setkey up "^Y"<br />
setkey up "k"<br />
setkey up "^P"<br />
setkey up "^K"<br />
setkey page_down "f"<br />
setkey page_down "^F"<br />
setkey page_up "b"<br />
setkey page_up "^B"<br />
setkey other_window "z"<br />
setkey other_window "w"<br />
setkey search_backward "?"<br />
setkey bob "p"<br />
setkey goto_mark "'"<br />
setkey find_file "E"<br />
setkey edit "v"<br />
<br />
===Second method: using 'less'===<br />
:<small>''Source: [http://nion.modprobe.de/blog/archives/572-less-colors-for-man-pages.html nion's blog - less colors for man pages]''</small><br />
<br />
Alternatively, getting an approximate coloured result in manual pages with {{Ic|less}} is also a possibility. This method has the advantage that {{Ic|less}} has a bigger feature set than {{Ic|most}}, and that might be the preference for advanced users.<br />
<br />
Add the following to a shell configuration file. For [[Bash]] it would be {{ic|~/.bashrc}}:<br />
<pre><br />
man() {<br />
env \<br />
LESS_TERMCAP_mb=$(printf "\e[1;31m") \<br />
LESS_TERMCAP_md=$(printf "\e[1;31m") \<br />
LESS_TERMCAP_me=$(printf "\e[0m") \<br />
LESS_TERMCAP_se=$(printf "\e[0m") \<br />
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \<br />
LESS_TERMCAP_ue=$(printf "\e[0m") \<br />
LESS_TERMCAP_us=$(printf "\e[1;32m") \<br />
man "$@"<br />
}<br />
</pre><br />
<br />
To customize the colors, see [[Wikipedia:ANSI escape code]] for reference.<br />
<br />
=== Colored man pages on xterm or rxvt-unicode ===<br />
<br />
:<small>''Source:[http://pub.ligatura.org/fs/xfree86/xresources/xterm XFree resources file for XTerm program]''</small><br />
<br />
A quick way to add color to manual pages viewed on {{Pkg|xterm}}/{{Ic|uxterm}} or {{Pkg|rxvt-unicode}} can be made modifying the {{ic|~/.Xresources}} file.<br />
<br />
{{Note|If {{ic|~/.Xresources}} does not work for you, you can try using {{ic|~/.Xdefaults}}.}}<br />
<br />
Open that file in an editor and add this lines:<br />
<br />
(For xterm)<br />
*VT100.colorBDMode: true<br />
*VT100.colorBD: red<br />
*VT100.colorULMode: true<br />
*VT100.colorUL: cyan<br />
<br />
which ''replaces'' the decorations with the colors. Also add<br />
<br />
*VT100.veryBoldColors: 6<br />
<br />
if you want colors and decorations (bold or underline) ''at the same time''. See {{ic|man xterm}} for a description of the {{ic|veryBoldColors}} resource.<br />
<br />
(For rxvt-unicode)<br />
URxvt.colorIT: #87af5f<br />
URxvt.colorBD: #d7d7d7<br />
URxvt.colorUL: #87afd7<br />
<br />
Save and run:<br />
$ xrdb -load ~/.Xresources<br />
<br />
Launch a new {{Ic|xterm/uxterm}} or {{Ic|rxvt-unicode}} and you should see colorful man pages.<br />
This combination puts colors to '''bold''' and <u>underlined</u> words in {{Ic|xterm/uxterm}} or to '''bold''', <u>underlined</u>, and ''italicized'' text in {{Ic|rxvt-unicode}}. You can play with different combinations of these attributes (see the [http://pub.ligatura.org/fs/xfree86/xresources/xterm sources] of this item).<br />
<br />
==Reading man pages with a browser==<br />
Instead of the standard interface, using browsers such as [[lynx]] and [[Firefox]] to view man pages allows users to reap info pages' main benefit: hyperlinked text.<br />
Additionally, [[KDE]] users can read man pages in Konqueror using:<br />
man:<name><br />
<br />
===Using Local Man Pages===<br />
First, install {{AUR|man2html}} from the [[Arch User Repository|AUR]].<br />
<br />
Now, convert a man page:<br />
$ man free | man2html -compress -cgiurl man$section/$title.$section$subsection.html > ~/man/free.html<br />
<br />
Another use for {{Ic|man2html}} is exporting to raw, printer-friendly text:<br />
$ man free | man2html -bare > ~/free.txt<br />
<br />
The GNU implementation of man in the Arch repositories also has the ability to do this on its own:<br />
$ man -H free<br />
<br />
This will read your {{ic|BROWSER}} environment variable to determine the browser. You can override this by passing the binary to the {{ic|-H}} option.<br />
<br />
===Using Online Man Pages===<br />
There are several online databases of man pages, including:<br />
*[http://manpages.debian.net/ ''Debian GNU/Linux man pages'']<br />
*[http://leaf.dragonflybsd.org/cgi/web-man ''DragonFlyBSD manual pages'']<br />
*[http://www.freebsd.org/cgi/man.cgi ''FreeBSD Hypertext Man Pages'']<br />
*[http://www.manpages.spotlynx.com/ ''Linux and Solaris 10 Man Pages'']<br />
*[http://manpagehelp.net ''Linux/FreeBSD Man Pages''] with user comments<br />
*[http://linux.die.net/man/ ''Linux man pages at die.net'']<br />
*[http://www.kernel.org/doc/man-pages/ The Linux man-pages project at kernel.org]<br />
*[http://man-wiki.net/index.php/Main_Page Man-Wiki: ''Linux / Solaris / UNIX / BSD'']<br />
*[http://netbsd.gw.com/cgi-bin/man-cgi ''NetBSD manual pages'']<br />
*[http://developer.apple.com/documentation/Darwin/Reference/ManPages/index.html ''Mac OS X Manual Pages'']<br />
*[http://unixhelp.ed.ac.uk/alphabetical/index.html ''On-line UNIX manual pages'']<br />
*[http://www.openbsd.org/cgi-bin/man.cgi ''OpenBSD manual pages'']<br />
*[http://man.cat-v.org/plan_9/ ''Plan 9 Manual — Volume 1'']<br />
*[http://man.cat-v.org/inferno/ ''Inferno Manual — Volume 1'']<br />
*[http://sfdoccentral.symantec.com/sf/5.0MP3/linux/manpages/index.html ''Storage Foundation Man Pages'']<br />
*[http://www.unix.com/man-page/OpenSolaris/1/man/ ''The UNIX and Linux Forums Man Page Repository'']<br />
*[http://manpages.ubuntu.com/ ''Ubuntu Manpage Repository'']</div>Enoksrdhttps://wiki.archlinux.org/index.php?title=X_resources&diff=195294X resources2012-04-20T01:33:15Z<p>Enoksrd: /* Terminal colors */ Added a link to the color man pages wiki page, because that's what I was actually looking for when google brought me here.</p>
<hr />
<div>{{i18n|X resources}}<br />
[[de:Xdefaults]]<br />
[[Category:Dotfiles (English)]]<br />
[[Category:X Server (English)]]<br />
<br />
'''Xresources''' and '''Xdefaults''' are user-level configuration ''dotfiles'', typically located at {{ic|~/.Xresources}} and {{ic|~/.Xdefaults}}. They can be used to set [[Wikipedia:X resources|X resources]], which are configuration parameters for X client applications.<br />
<br />
They can do many operations, including:<br />
<br />
* defining terminal colours<br />
* configuring terminal preferences<br />
* setting DPI, antialiasing, hinting and other X font settings<br />
* changing the Xcursor theme<br />
* theming xscreensaver<br />
* altering preferences on low-level X applications (xclock ({{Pkg|xorg-xclock}}), {{Pkg|xpdf}}, {{Pkg|rxvt-unicode}}, etc.)<br />
<br />
{{Note|Using {{ic|~/.Xdefaults}} is deprecated, so this article will refer to {{ic|~/.Xresources}} only.}}<br />
<br />
==Getting started==<br />
<br />
===Parsing .Xresources===<br />
The file {{ic|~/.Xresources}} does not exist by default. Being a plain-text file, you can create and edit it with the text editor of your choice. Once present, it will be parsed by the {{ic|xrdb}} (Xorg resource database) program automatically when [[Xorg]] is started, storing the resources in the X server so the file does not need to be re-read. You must re-run {{ic|xrdb ~/.Xresources}} every time you change the file, or restart Xorg.<br />
<br />
To reread your .Xresources file, and throw away your old resources <br />
xrdb ~/.Xresources<br />
<br />
To reread your .Xresources file, and keep your old resources<br />
xrdb -merge ~/.Xresources<br />
<br />
{{Note|<br />
*If you use xrdb manually you can actually put the file anywhere you want, for example in {{ic|~/.config/Xresources}}.<br />
*If you background the execution of xrdb in a chain of commands in {{ic|~/.xinitrc}}, the programs launched in the same chain might not be able to make use of it, so it is recommended to ''never'' background the xrdb command within {{ic|~/.xinitrc}}.<br />
*The older (deprecated) {{ic|~/.Xdefaults}} file is read every time you start an X program such as {{ic|xterm}}, but '''only''' if {{ic|xrdb}} has not '''ever''' been used in the current X session. [http://groups.google.com/group/comp.windows.x/msg/6c1c083711c35d84]<br />
*Works for remote X clients too<br />
}}<br />
<br />
===Adding to xinitrc===<br />
If you do not use a [[Desktop Environment|desktop environment]], you probably need to add the following line to your {{ic|~/.[[xinitrc]]}}:<br />
<nowiki>[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources</nowiki><br />
<br />
===Default settings===<br />
To see the default settings for your installed X11 apps, look in {{ic|/usr/share/X11/app-defaults/}}.<br />
<br />
Detailed information on program specific resources is usually provided in the man page for that app. Xterms manpage is a good example, containing a list of resources and the default value.<br />
<br />
To see the current loaded resources:<br />
xrdb -query -all<br />
<br />
===Xresources syntax===<br />
====The basic syntax====<br />
The syntax of an Xresources file is as follows:<br />
'''name.Class.resource: value'''<br />
and here is a real world example:<br />
xscreensaver.Dialog.headingFont: -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1<br />
<br />
;name<br />
:The name of the application, such xterm, xpdf, etc<br />
<br />
;class<br />
:The classification used to group resources together. Class names are typically uppercase.<br />
<br />
;resource<br />
:The name of the resource whose value is to be changed. Resources are typically lowercase with uppercase concatenation.<br />
<br />
;value<br />
:The actual value of the resource. This can be 1 of 3 types:<br />
:* Integer (whole numbers)<br />
:* Boolean (true/false, yes/no, on/off)<br />
:* String (a string of characters) (for example a word (white), a color (#ffffff), or a path (/usr/bin/firefox))<br />
<br />
;delimiters<br />
:A period ('''.''') is used to signify each step down into the hierarchy -- in the above example we start at name, then descend into Class, and finally into the resource itself. A colon (''':''') is used to separate the resource declaration from the actual value.<br />
<br />
====Wildcard matching====<br />
The asterisk can be used as a wildcard, making it easy to write a single rule that can be applied to many different applications or elements. <br />
<br />
Using the previous example, if you want to apply the same font to all programs (not just xscreensaver) that contain the class name ''Dialog'' which contains the resource name ''headingFont'', you would write:<br />
'''*'''Dialog.headingFont: -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1<br />
<br />
If you want to apply this same rule to all programs that contain the resource ''headingFont'' regardless of its class, you would write:<br />
'''*'''headingFont: -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1<br />
<br />
====Commenting====<br />
To add a comment to your Xresources file, simply prefix it with an exclamation point (!), for example:<br />
! This is a comment placed above some Xft settings<br />
Xft.dpi: 96 ! this is an inline comment<br />
<br />
! The following rule will be ignored because it has been commented out<br />
!Xft.antialias: true<br />
<br />
==Sample usage==<br />
The following samples should provide a good understanding of how application settings can be modified using an Xresources file. For full details, refer to the man page of the application in question.<br />
<br />
===File header===<br />
If desired, you can add a header to {{ic|~/.Xresources}} which not only explains the file's contents, but also instruct [[vim]] on how to perform syntax highlighting and other formatting. For example:<br />
{{bc|1=<br />
! ----------------------------------------------------------------------------<br />
! file: ~/.Xresources<br />
! author: Thayer Williams - http://cinderwick.ca<br />
! modified: November 2008<br />
! vim: set fenc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=xdefaults:<br />
! ----------------------------------------------------------------------------<br />
}}<br />
<br />
This will instruct vim to use UTF-8 encoding, display line numbers, auto-indent, smart-indent, expand tabs to spaces, set tabs to equal 4 spaces, and set the autocommand Filetype to "xdefaults".<br />
<br />
It is a good habit to get into, especially if you'd like to make your dotfiles available for public consumption.<br />
<br />
===Terminal colors===<br />
Most terminals, including [[xterm]] and [[urxvt]], support at least 16 basic colors. The following is an example of a 16-color scheme. The colors 0-7 are the 'normal' colors, while colors 8-15 are their 'bright' counterparts, used for highlighting and such. A good place to start when making your Xresources, is to define the default terminal colors: <br />
{{bc|<br />
! terminal colors ------------------------------------------------------------<br />
<br />
! tangoesque scheme<br />
*background: #111111<br />
*foreground: #babdb6<br />
! Black (not tango) + DarkGrey<br />
*color0: #000000<br />
*color8: #555753<br />
! DarkRed + Red<br />
*color1: #ff6565<br />
*color9: #ff8d8d<br />
! DarkGreen + Green<br />
*color2: #93d44f<br />
*color10: #c8e7a8<br />
! DarkYellow + Yellow<br />
*color3: #eab93d<br />
*color11: #ffc123<br />
! DarkBlue + Blue<br />
*color4: #204a87<br />
*color12: #3465a4<br />
! DarkMangenta + Mangenta<br />
*color5: #ce5c00<br />
*color13: #f57900<br />
!DarkCyan + Cyan (both not tango)<br />
*color6: #89b6e2<br />
*color14: #46a4ff<br />
! LightGrey + White<br />
*color7: #cccccc<br />
*color15: #ffffff<br />
}}<br />
<br />
See [[Man_Page#Colored_man_pages_on_xterm_or_rxvt-unicode]] for how to color bold and underlined text automatically xterm and rxvt.<br />
<br />
For more examples of color schemes, see the [[#More resources]] section at the bottom of this article.<br />
<br />
===Xcursor resources===<br />
Set the theme and size of your mouse cursor:<br />
<br />
! Xcursor --------------------------------------------------------------------<br />
<br />
Xcursor.theme: Vanilla-DMZ-AA<br />
Xcursor.size: 22<br />
<br />
Available themes reside in {{ic|/usr/share/icons}} and local themes can be installed to {{ic|~/.icons}}.<br />
<br />
===Xft resources===<br />
You can define basic font resources without the need of a {{ic|fonts.conf}} file or a desktop environment. Note however, the use of a desktop environment and/or {{ic|fonts.conf}} can override these settings. Your best option is to use one or the other, but not both.<br />
<br />
! Xft settings ---------------------------------------------------------------<br />
<br />
Xft.dpi: 96<br />
Xft.antialias: true<br />
Xft.rgba: rgb<br />
Xft.hinting: true<br />
Xft.hintstyle: hintslight<br />
<br />
===Xterm resources===<br />
The following resources will open [[xterm]] in an 80x25 character window with a scroll-bar and scroll capability for the last 512 lines. The specified [[Fonts#Terminal|Terminus]] facename is a popular and clean terminal font.<br />
<br />
! xterm ----------------------------------------------------------------------<br />
<br />
xterm*geometry: 80x25<br />
xterm*faceName: terminus:bold:pixelsize=14<br />
!xterm*font: -*-dina-medium-r-*-*-16-*-*-*-*-*-*-*<br />
xterm*dynamicColors: true<br />
xterm*utf8: 2<br />
xterm*eightBitInput: true<br />
xterm*saveLines: 512<br />
xterm*scrollKey: true<br />
xterm*scrollTtyOutput: false<br />
xterm*scrollBar: true<br />
xterm*rightScrollBar: true<br />
xterm*jumpScroll: true<br />
xterm*multiScroll: true<br />
xterm*toolBar: false<br />
<br />
===rxvt-unicode (urxvt) resources===<br />
{{Pkg|rxvt-unicode}} features an extensive list of options which can be configured via {{ic|~/.Xresources}}. Refer to the urxvt man page or [[Urxvt#Creating_.7E.2F.Xresources|this wiki article]] for details.<br />
<br />
===Aterm preferences===<br />
Sample settings for aterm (very similar to urxvt):<br />
<br />
!aterm settings------------------------------------------------------------- <br />
<br />
aterm*background: black<br />
aterm*foreground: white<br />
aterm*transparent: true<br />
aterm*shading: 30<br />
aterm*cursorColor: gray<br />
aterm*saveLines: 2000<br />
!aterm*tinting: gray<br />
aterm*scrollBar: false<br />
!aterm*scrollBar_right: true<br />
aterm*transpscrollbar: true<br />
aterm*borderwidth: 0<br />
aterm*font: -*-terminus-*-*-*-*-*-*-*-*-*-*-*-*<br />
aterm*geometry: 80x25<br />
!aterm*fading: 70 <br />
<br />
===Xpdf resources===<br />
Following are some basic resources for [[xpdf]], a lightweight PDF viewer:<br />
<br />
! xpdf -----------------------------------------------------------------------<br />
<br />
xpdf*enableFreetype: yes<br />
xpdf*antialias: yes<br />
xpdf*foreground: black<br />
xpdf*background: white<br />
xpdf*urlCommand: /usr/bin/firefox %s<br />
<br />
Anything more detailed than the above you should be putting in {{ic|~/.xpdfrc}} instead. See the xpdf man page for more information. Note that {{ic|viKeys}} is deprecated.<br />
<br />
===Lal clock resources===<br />
<br />
! lal clock ------------------------------------------------------------------<br />
<br />
lal*font: Arial<br />
lal*fontsize: 12<br />
lal*bold: true<br />
lal*color: #ffffff<br />
lal*width: 150<br />
lal*format: %a %b %d %l:%M%P<br />
<br />
===Xclock preferences===<br />
Some basic xclock settings. See the xclock man page for all X resources.<br />
<br />
! xclock ---------------------------------------------------------------------<br />
<br />
xclock*update: 1<br />
xclock*analog: false<br />
xclock*Foreground: white<br />
xclock*background: black<br />
<br />
===X11-ssh-askpass resources===<br />
<br />
! x11-ssh-askpass ------------------------------------------------------------<br />
<br />
x11-ssh-askpass*font: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
x11-ssh-askpass*background: #000000<br />
x11-ssh-askpass*foreground: #ffffff<br />
x11-ssh-askpass.Button*background: #000000<br />
x11-ssh-askpass.Indicator*foreground: #ff9900<br />
x11-ssh-askpass.Indicator*background: #090909<br />
x11-ssh-askpass*topShadowColor: #000000<br />
x11-ssh-askpass*bottomShadowColor: #000000<br />
x11-ssh-askpass.*borderWidth: 1<br />
<br />
===XScreenSaver resources===<br />
The following is a sample [[Xscreensaver|XScreenSaver]] theme. For more information, refer to the XScreenSaver man page.<br />
<br />
{{Note|If the {{ic|~/.xscreensaver}} file exists, then these X resources will ''not'' be used.}}<br />
<br />
! xscreensaver ---------------------------------------------------------------<br />
<br />
!font settings<br />
xscreensaver.Dialog.headingFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.bodyFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.labelFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.unameFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.buttonFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.dateFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.passwd.passwdFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-*<br />
!general dialog box (affects main hostname, username, password text)<br />
xscreensaver.Dialog.foreground: #ffffff<br />
xscreensaver.Dialog.background: #111111<br />
xscreensaver.Dialog.topShadowColor: #111111<br />
xscreensaver.Dialog.bottomShadowColor: #111111<br />
xscreensaver.Dialog.Button.foreground: #666666<br />
xscreensaver.Dialog.Button.background: #ffffff<br />
!username/password input box and date text colour<br />
xscreensaver.Dialog.text.foreground: #666666<br />
xscreensaver.Dialog.text.background: #ffffff<br />
xscreensaver.Dialog.internalBorderWidth:24<br />
xscreensaver.Dialog.borderWidth: 20<br />
xscreensaver.Dialog.shadowThickness: 2<br />
!timeout bar (background is actually determined by Dialog.text.background)<br />
xscreensaver.passwd.thermometer.foreground: #ff0000<br />
xscreensaver.passwd.thermometer.background: #000000<br />
xscreensaver.passwd.thermometer.width: 8<br />
!datestamp format--see the strftime(3) manual page for details<br />
xscreensaver.dateFormat: %I:%M%P %a %b %d, %Y<br />
<br />
===Xcalc resources===<br />
Following are some xcalc resources to colorize and customize buttons.<br />
<br />
!xcalc-----------------------------------------------------------------------<br />
<br />
xcalc*geometry: 200x275<br />
xcalc.ti.bevel.background: #111111<br />
xcalc.ti.bevel.screen.background: #000000<br />
xcalc.ti.bevel.screen.DEG.background: #000000<br />
xcalc.ti.bevel.screen.DEG.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.GRAD.background: #000000<br />
xcalc.ti.bevel.screen.GRAD.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.RAD.background: #000000<br />
xcalc.ti.bevel.screen.RAD.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.INV.background: #000000<br />
xcalc.ti.bevel.screen.INV.foreground: Red<br />
xcalc.ti.bevel.screen.LCD.background: #000000<br />
xcalc.ti.bevel.screen.LCD.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.LCD.shadowWidth: 0<br />
xcalc.ti.bevel.screen.M.background: #000000<br />
xcalc.ti.bevel.screen.M.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.P.background: #000000<br />
xcalc.ti.bevel.screen.P.foreground: Yellow<br />
xcalc.ti.Command.foreground: White<br />
xcalc.ti.Command.background: #777777<br />
xcalc.ti.button5.background: Orange3<br />
xcalc.ti.button19.background: #611161<br />
xcalc.ti.button18.background: #611161<br />
xcalc.ti.button20.background: #611111<br />
!uncomment to change label on division button<br />
!xcalc.ti.button20.label: /<br />
xcalc.ti.button25.background: #722222<br />
xcalc.ti.button30.background: #833333<br />
xcalc.ti.button35.background: #944444<br />
xcalc.ti.button40.background: #a55555<br />
xcalc.ti.button22.background: #222262<br />
xcalc.ti.button23.background: #222262<br />
xcalc.ti.button24.background: #222272<br />
xcalc.ti.button27.background: #333373<br />
xcalc.ti.button28.background: #333373<br />
xcalc.ti.button29.background: #333373<br />
xcalc.ti.button32.background: #444484<br />
xcalc.ti.button33.background: #444484<br />
xcalc.ti.button34.background: #444484<br />
xcalc.ti.button37.background: #555595<br />
xcalc.ti.button38.background: #555595<br />
xcalc.ti.button39.background: #555595<br />
XCalc*Cursor: hand2<br />
XCalc*ShapeStyle: rectangle<br />
<br />
==Color scheme commands==<br />
Here are some fast bash commands you can run right in your shell.<br />
<br />
===Display all 256 colors===<br />
Prints all 256 colors across the screen, very quick.<br />
<nowiki>(x=`tput op` y=`printf %76s`;for i in {0..256};do o=00$i;echo -e ${o:${#o}-3:3} `tput setaf $i;tput setab $i`${y// /=}$x;done)</nowiki><br />
<br />
===Display tput escape codes===<br />
Replace 'tput op' with whatever tput you want to trace. '''op''' is the default foreground and background color.<br />
{{hc<br />
|<nowiki>$ ( strace -s5000 -e write tput op 2>&2 2>&1 ) | tee -a /dev/stderr | grep -o '"[^"]*"'</nowiki><br />
|033[\033[1;34m"\33[39;49m"\033[00m<br />
}}<br />
<br />
===Enumerating colors supported by terminals===<br />
The following command will let you discover all the terminals you have terminfo support for, and the number of colors each terminal supports. The possible values are: 8, 15, 16, 52, 64, 88 and 256.<br />
{{hc<br />
|<nowiki>$ for T in `find /usr/share/terminfo -type f -printf '%f '`;do echo "$T `tput -T $T colors`";done|sort -nk2</nowiki><br />
|Eterm-88color 88<br />
rxvt-88color 88<br />
xterm+88color 88<br />
xterm-88color 88<br />
Eterm-256color 256<br />
gnome-256color 256<br />
konsole-256color 256<br />
putty-256color 256<br />
rxvt-256color 256<br />
screen-256color 256<br />
screen-256color-bce 256<br />
screen-256color-bce-s 256<br />
screen-256color-s 256<br />
xterm+256color 256<br />
xterm-256color 256<br />
}}<br />
<br />
===Enumerating terminal capabilities===<br />
This command is useful to see what features that are supported by your terminal.<br />
{{hc<br />
|<nowiki>$ infocmp -1 | sed -nu 's/^[ \000\t]*//;s/[ \000\t]*$//;/[^ \t\000]\{1,\}/!d;/acsc/d;s/=.*,//p'|column -c80</nowiki><br />
|bel cuu ich kb2 kf15 kf3 kf44 kf59 mc0 rmso smul<br />
blink cuu1 il kbs kf16 kf30 kf45 kf6 mc4 rmul tbc<br />
bold cvvis il1 kcbt kf17 kf31 kf46 kf60 mc5 rs1 u6<br />
cbt dch ind kcub1 kf18 kf32 kf47 kf61 meml rs2 u7<br />
civis dch1 indn kcud1 kf19 kf33 kf48 kf62 memu sc u8<br />
clear dl initc kcuf1 kf2 kf34 kf49 kf63 op setab u9<br />
cnorm dl1 invis kcuu1 kf20 kf35 kf5 kf7 rc setaf vpa<br />
}}<br />
<br />
==Color scheme scripts==<br />
Any of the following scripts will display a chart of your current terminal color scheme. Handy for testing and whatnot.<br />
<br />
===Script #1===<br />
{{bc|1=<br />
#!/bin/bash<br />
#<br />
# This file echoes a bunch of color codes to the <br />
# terminal to demonstrate what's available. Each <br />
# line is the color code of one forground color,<br />
# out of 17 (default + 16 escapes), followed by a <br />
# test use of that color on all nine background <br />
# colors (default + 8 escapes).<br />
#<br />
<br />
T='gYw' # The test text<br />
<br />
echo -e "\n 40m 41m 42m 43m\<br />
44m 45m 46m 47m";<br />
<br />
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \<br />
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \<br />
' 36m' '1;36m' ' 37m' '1;37m';<br />
do FG=${FGs// /}<br />
echo -en " $FGs \033[$FG $T "<br />
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;<br />
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";<br />
done<br />
echo;<br />
done<br />
echo<br />
}}<br />
<br />
===Script #2===<br />
{{bc|1=<br />
#!/bin/bash<br />
# Original: http://frexx.de/xterm-256-notes/<br />
# http://frexx.de/xterm-256-notes/data/colortable16.sh<br />
# Modified by Aaron Griffin<br />
# and further by Kazuo Teramoto<br />
FGNAMES=(' black ' ' red ' ' green ' ' yellow' ' blue ' 'magenta' ' cyan ' ' white ')<br />
BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT')<br />
<br />
echo " ┌──────────────────────────────────────────────────────────────────────────┐"<br />
for b in {0..8}; do<br />
((b>0)) && bg=$((b+39))<br />
<br />
echo -en "\033[0m ${BGNAMES[b]} │ "<br />
<br />
for f in {0..7}; do<br />
echo -en "\033[${bg}m\033[$((f+30))m ${FGNAMES[f]} "<br />
done<br />
<br />
echo -en "\033[0m │"<br />
echo -en "\033[0m\n\033[0m │ "<br />
<br />
for f in {0..7}; do<br />
echo -en "\033[${bg}m\033[1;$((f+30))m ${FGNAMES[f]} "<br />
done<br />
<br />
echo -en "\033[0m │"<br />
echo -e "\033[0m"<br />
<br />
((b<8)) &&<br />
echo " ├──────────────────────────────────────────────────────────────────────────┤"<br />
done<br />
echo " └──────────────────────────────────────────────────────────────────────────┘"<br />
}}<br />
<br />
===Script #3===<br />
{{bc|1=<br />
#!/bin/bash<br />
# Original: http://frexx.de/xterm-256-notes/<br />
# http://frexx.de/xterm-256-notes/data/colortable16.sh<br />
# Modified by Aaron Griffin<br />
# and further by Kazuo Teramoto<br />
<br />
<br />
FGNAMES=(' black ' ' red ' ' green ' ' yellow' ' blue ' 'magenta' ' cyan ' ' white ')<br />
BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT')<br />
echo " ----------------------------------------------------------------------------"<br />
for b in $(seq 0 8); do<br />
if [ "$b" -gt 0 ]; then<br />
bg=$(($b+39))<br />
fi<br />
<br />
echo -en "\033[0m ${BGNAMES[$b]} : "<br />
for f in $(seq 0 7); do<br />
echo -en "\033[${bg}m\033[$(($f+30))m ${FGNAMES[$f]} "<br />
done<br />
echo -en "\033[0m :"<br />
<br />
echo -en "\033[0m\n\033[0m : "<br />
for f in $(seq 0 7); do<br />
echo -en "\033[${bg}m\033[1;$(($f+30))m ${FGNAMES[$f]} "<br />
done<br />
echo -en "\033[0m :"<br />
echo -e "\033[0m"<br />
<br />
if [ "$b" -lt 8 ]; then<br />
echo " ----------------------------------------------------------------------------"<br />
fi<br />
done<br />
echo " ----------------------------------------------------------------------------"<br />
}}<br />
<br />
===Script #4===<br />
{{bc|1=<br />
#!/usr/bin/env lua<br />
<br />
function cl(e)<br />
return string.format('\27[%sm', e)<br />
end<br />
<br />
function print_fg(bg, pre)<br />
for fg = 30,37 do<br />
fg = pre..fg<br />
io.write(cl(bg), cl(fg), string.format(' %6s ', fg), cl(0))<br />
end<br />
end<br />
<br />
for bg = 40,47 do<br />
io.write(cl(0), ' ', bg, ' ')<br />
print_fg(bg, '')<br />
io.write('\n ')<br />
print_fg(bg, '1;')<br />
io.write('\n\n')<br />
end<br />
<br />
-- Andres P<br />
}}<br />
===Script #5===<br />
{{bc|1=<br />
#!/bin/bash<br />
#<br />
# ANSI color scheme script featuring Space Invaders<br />
#<br />
# Original: http://crunchbanglinux.org/forums/post/126921/#p126921<br />
# Modified by lolilolicon<br />
#<br />
<br />
f=3 b=4<br />
for j in f b; do<br />
for i in {0..7}; do<br />
printf -v $j$i %b "\e[${!j}${i}m"<br />
done<br />
done<br />
bld=$'\e[1m'<br />
rst=$'\e[0m'<br />
<br />
cat << EOF<br />
<br />
$f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst<br />
$f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst<br />
$f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst<br />
$f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst<br />
<br />
$bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst<br />
$bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst<br />
$bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst<br />
$bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst<br />
<br />
<br />
$f7▌$rst<br />
<br />
$f7▌$rst<br />
<br />
$f7 ▄█▄ $rst<br />
$f7▄█████████▄$rst<br />
$f7▀▀▀▀▀▀▀▀▀▀▀$rst<br />
<br />
EOF<br />
}}<br />
<br />
==Contributed examples==<br />
Check out these links for some real world examples of X resource files, contributed by fellow community members.<br />
{{Note|{{ic|~/.Xdefaults}} has the same syntax as {{ic|~/.Xresources}}, and it is recommended that you use {{ic|~/.Xresources}} because {{ic|~/.Xdefaults}} is deprecated upstream.}}<br />
<br />
* http://dotfiles.org/~buttons/.Xdefaults<br />
* http://code.suckless.org/hg/dextra/file/513faba2591f/dolby/Xdefaults<br />
* http://github.com/stxza/arch-linux-configs/tree/master/.Xdefaults<br />
* http://github.com/jelly/dotfiles/tree/master/.Xdefaults<br />
* https://github.com/sunaku/home/blob/master/.Xdefaults<br />
<br />
==See also==<br />
* [https://engineering.purdue.edu/ECN/Support/KB/Docs/UsingTheXdefaultsFil Using the Xdefaults File] - An in-depth article on how X interprets the Xdefaults file<br />
* [http://wiki.afterstep.org/index.php?title=Rxvt-Unicode_Configuration_Tutorial Rxvt-unicode Configuration Tutorial] - lots of information for urxvt users<br />
* [http://mkaz.com/ref/xterm_colors.html Example Colors and their names] - listing of example colors and their color names for xterm and other X-applications.<br />
* [http://web.archive.org/web/20090130061234/http://phraktured.net/terminal-colors/ Color Themes] - Extensive list of terminal color themes by Phraktured.</div>Enoksrd