Jump to content






Photo
- - - - -

$PATH, alias, and chsh

Posted by notKlaatu , 04 March 2008 · 35 views

In Slackware, the tendency is for an administrative user to set up accounts for the users. Users either don't have access to commands like iwconfig or iwlist or ifconfig and things like that, or else they just don't need them that often so there's no need to make these commands easily accessible to the regular user account.   On Ubuntu, the default is that the initial user on the system is an admin/user hybrid, in which most of the typical admin commands are just one command-type away, although they may require a password in order to be executed.   On my Fedora 8 install, it would seem that the Slackware approach is taken, which I like quite a bit; so in Fedora, when I type iwconfig, I get a return that "-bash command is not found" or whatever the error message is. Nice to know that layer of admin vs. user separation is there...but a little inconvenient for me since in fact I am the only user as well as admin. So, if this sort of thing happens to you under either Slackware, Debian, or Fedora, or any other Linux OS you install, you may want to modify your PATH.   The symptom is this:  In order to get a command like iwlist to work, you have to type /sbin/iwlist   The fix is to set your environment.   To do this, simply edit your .bashrc in a text editor and define your variables.   So, to beef up the paths on my Fedora system, I simply did this:   % cd ~  % vim .bashrc    and then typed this:   # added by klaatu 12-31-07  PATH="/usr/bin:/usr/sbin:/sbin:/bin:/usr/games:/usr/local/bin:/usr/locate/sbin"   Or something like that; basically I just kept everything Fedora had already defined for me, and added my own.   To make the system reanalyze its environment settings, type:   % source .bashrc    And that was that.   Well, almost. I was really getting annoyed at having to go all the way up to the Application menu just to play Tetris. I also always forget that it's isn't Tetris, it's Gnome-Falling-Bricks?.   To make it so that I could just type "tetris" and be playing Gnome-Falling-Bricks?, a game similar in many ways to the classic Tetris game, I needed to set an alias. This again would be done in my .bashrc. Simply add this:   alias tetris="gnome-falling-bricks"    Again, run   % source .bashrc    and you're in business.    Caveat and Apologies   This all applies only to bash, hence hence the modification of the .bashrc file. If you are using a different shell you'll need to modify its corresponding file.   For instance, in Slackware I'm using the Z shell, so these settings, or similar ones, would be entered into .zshrc    Change Your Default Shell   One of the variables of your environment can't be entered into your .bashrc or .zshrc or .csh or .tcsh or whatever; it's the default shell. This must be set by running this command:   % chsh   you'll enter your password, and then define your choice of shell          PS   Here are some of the environment variables on a Linux system:  PATH — sets directories that executable programs should be found  HOME — your "user" or "home" directory  EDITOR — your default editor  TEXEDIT — your default text editor  VISUAL — your default picture viewer  LD_LIBRARY_PATH — directory in which libraries to run programs are found  HOST, HOSTTYPE, VENDOR, OSTYPE, MACHTYPE, REMOTEHOST — info about your computer  LINES, COLUMNS — sets your terminal size  MAIL — your system email mailbox  TERM — sets type of terminal you run (rxvt, xterm, &c)  TZ - timezone  SHELL — your default shell




May 2013

S M T W T F S
   1234
567891011
12131415161718
1920212223 24 25
262728293031 

Recent Entries

Recent Comments

Search My Blog

BinRev is hosted by the great people at Lunarpages!