User Tools

(aka 'the best point military institute')

Site Tools

tools:bash:customization

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
tools:bash:customization [2024/06/04 02:44] – [Color Codes] Humphrey Boa-Garttools:bash:customization [2026/03/08 09:12] (current) – [$PATH] Humphrey Boa-Gart
Line 40: Line 40:
 As you start to use bash more often, you will find yourself using specific combinations of commands and flags to accomplish basic tasks. You can drastically cut the amount of typing you will do by setting **aliases**, which are just pseudo-commands that refer to other commands. These are the simplest customizations to make to bash. As you start to use bash more often, you will find yourself using specific combinations of commands and flags to accomplish basic tasks. You can drastically cut the amount of typing you will do by setting **aliases**, which are just pseudo-commands that refer to other commands. These are the simplest customizations to make to bash.
  
-For example, lets look at the ''ls'' command. The default output of ls is very bare-bones, and you have to type something like ''ls -lhaF'' to get a more detailed view. To make it so typing ''ls'' by itself gives you an easy-to-read detail view, add the following line to your **.bash_aliases** file:+For example, lets look at the ''ls'' command. The default output of ls is very bare-bones, and you have to type something like ''ls -lhAF'' to get a more detailed view. To make it so typing ''ls'' by itself gives you an easy-to-read detail view, add the following line to your **.bash_aliases** file:
  
-  ls='ls -lhaF --color=auto'+  ls='ls -lhAF --color=auto'
  
 Aliases do not have to be permanent, either. To set that same alias to only work for the current shell session, you would run: Aliases do not have to be permanent, either. To set that same alias to only work for the current shell session, you would run:
  
-  $ alias ls=\'ls -lhaF --color=auto\'+  $ alias ls=\'ls -lhAF --color=auto\'
  
 To unset that alias, you would run: To unset that alias, you would run:
Line 72: Line 72:
   PS1='\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\] \[\033[01;32m\]\$\[\033[00m\] '   PS1='\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\] \[\033[01;32m\]\$\[\033[00m\] '
  
-Here is a <wrap em>red version</wrap> of the same prompt, which you can add to the aliases file for a root user or superuser, so you can more easily tell at a glance when you are in an account with escalated privs:+Here is a separate <wrap em>red version</wrap> of the same prompt, which you can add to the aliases file for a root user or superuser, so you can more easily tell at a glance when you are in an account with escalated privs:
  
   PS1='\[\033[01;31m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\] \[\033[01;31m\]\$\[\033[00m\] '   PS1='\[\033[01;31m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\] \[\033[01;31m\]\$\[\033[00m\] '
Line 96: Line 96:
 ==== $PATH ==== ==== $PATH ====
  
-The most important variable you will deal with, is the **$PATH** variable, which specifies the directories that bash will look for executable files(So you can type ''appname'' instead of ''/path/to/appname'' into your shell to run the program.To figure out where your $PATH is, run:+The most important variable you will deal with, is the **$PATH** variable, which specifies the directories that bash will look for installed applicationsThis lets you type ''appname'' into your shell to run a program, instead of a drawn out path like ''/path/to/appname''. If the directory is not in your $PATH, then bash will not know to look there for apps. 
 + 
 +To figure out where your $PATH is, run:
  
   $ echo $PATH   $ echo $PATH
Line 102: Line 104:
 This will output something like: This will output something like:
  
-  /home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin+  /home/username/.local/bin:/usr/local/bin:/usr/bin:/bin
      
-This above line shows that bash will look in your personal **~/.local/bin** directory, as well as a list of common locations for globally-accessible binaries. Your system may have other locations appended here as well for things like games, [[tools:flatpak|Flatpak]] or [[tools:snap|Snap]].+This above line shows that bash will look in your personal **~/.local/bin** directory, as well as a list of common locations for globally-accessible binaries. Your system may have other locations appended here as well for things like games, [[tools:flatpak|Flatpak]] or [[tools:flatpak#snap|Snap]].
  
-To enable bash to run a custom application (such as a freshly downloaded [[tools:appimage|AppImage]] file) without having to type out the whole directory it is located in, you should place the file into your personal **~/.local/bin** directory. Or, you could put a symlink into that directory like so:+To enable bash to run a custom application //(such as a freshly downloaded [[tools:appimage|AppImage]] file)//, you should place the file into your personal **~/.local/bin** directory //(which will almost-always be in your $PATH by default on modern systems)//. Or, you could put a symlink into that directory like so:
  
   $ ln -s /path/to/the.appimage ~/.local/bin/commandname   $ ln -s /path/to/the.appimage ~/.local/bin/commandname
Line 202: Line 204:
 ===== ANSI Escape Codes ===== ===== ANSI Escape Codes =====
  
-When you set your custom hostname earlier in this article, you may have noticed a bunch of numbers on your new $PS1 line. Those are **ANSI Escape Codes** which you can use to tweak the style of bash output. You have a range of codes available:+When you set your custom hostname earlier in this article, you may have noticed the **\033[..m]** or **\033[..;..m]** blocks, which contain semicolon-separated list of other numbers with an **m**. Those **"m"** numbers are **ANSI Escape Codes** which you can use to tweak the style of bash output. You have a range of codes available:
  
 ==== Color Codes ==== ==== Color Codes ====
Line 226: Line 228:
 ==== Other Codes ==== ==== Other Codes ====
  
-<code> +Code Description     ^ 
-Code Description +| 00   Reset/Normal    | 
-0 Reset/Normal +| 01   Bold text       | 
-1 Bold text +| 02   Faint text      | 
-2 Faint text +| 03   Italics         | 
-3 Italics +| 04   Underlined text 
-4 Underlined text + 
-</code>+
  
-----+{{wst>cli}}
  
-  * [[tools:bash|Back to Index]] 
tools/bash/customization.1717469041.txt.gz · Last modified: (external edit)

Find this page online at: https://bestpoint.institute/tools/bash/customization