Refreshing Drink of Ideas

Linux / Unix Notes

This article is a list of notes I've collected to help me with Linux and/or Unix.  Please don't consider this a comprehensive reference.  I'm not a Linux or Unix expert.  These notes are just some things I've had to remember but always seem to forget when I've had to log onto a Linux or Unix machine for the following:
  • Setting up a website.  I think Linux is the easiest platform and has the most tools, free and open, readily available.
  • Attempting to develop an application for my Android phone (which uses a form a Unix) and experimenting with root access with a command prompt.
  • Hacking my older Directv Tivo DVR
I've never tried or even had much interest in using Linux and X11 windows as an alternative to MS Windows for my desktop.  So there won't be any notes about that in this article.

There are certainly more comprehensive and accessible Linux/Unix references out there on other websites.  However, because there were some things I couldn't find quickly enough or expressed simply enough or whatever, I found I needed to write my own notes.  These notes are now here where I can find them no matter where I am.  They are also for anybody else, due to being in the same situation for frame of mind as me, has Googled here for the quickest answer.

Wherever I list a shell command, the shell will most likely be Bash with a prompt of "$".   The commands can be used interactively from a terminal or from within a shell script.  Here are the notes below.

Display which shell processor is being used to interpret your commands at the command line:
$ echo $0
The above will echo out the name of the shell.  For example the output may be:
Alternatively to get the full path to the shell processor, do the following:
$ echo $SHELL

Listing the contents of a directory

$ ls
List each item with full attributes
$ ls -l

To list even files that begin with "." because these are normally hidden
$ ls -l -a

To list files that begin with "." but excluding the implied directory names of "." (current) or ".." (parent)

$ ls -l -A

A file name or directory name, with or without wildcards ('*" or "?"), may be be provided to get directory limited to files or directories that match. 

$ ls -l -A <filename>

If shell is set up for it (Bash usually is), then the easier to remember "dir" command can be used

$ dir -l -A

For quick help on any command, try including "--help" option:

$ dir --help

For extensive help (when available) use the "man" command:
$ man set
The above command will list out a manual article on the "set" command

Displaying the current directory (or working directory):
$ pwd

Changing the current directory - for example, to a directory called "public_html" under the current:
$ cd  public_html
A wildcard will make this quicker and easier to type if "public_html" is the only directory that begins with "pub"
$ cd pub*

To make a new subdirectory:
$mkdir <directory name>

The Bash shell can show the host name and current directory in each prompt.  This is the default on many Linux systems.  Set variable PS1 as follows:
$ PS1="\u@\h:\w\$"
Variable PS1 defines the prompt string for Bash.  With special escape character "\" commands cause system values to be inserted.  A good explanation for this was found at on the web here.

Changing the terminal type that system expects you to have
Just set the TERM variable
$ TERM=vt100

Listing all variables with their values
$ set

Exporting variables to sub-processes:
The first command will cause all subsequently created or modified variables to be exported
$ set -a
The next command will specify a list of names to export
$ export <names>

Start a background process
In the below example, the "&" indicates that the given command has a requirement for terminal access
$ <command> &

List running processes
The following will list all processes user is allowed to view based on authorization level
$ ps -e
A root user would be able to see all processes running on the system with the above.  A non-privileged user would only be able to see his own.

Use --help to see more options.

Execute a command as another user

This is may be allowed only if a privileged user.  Also may prompt for password. 

su -c "<command>" <userid>

Sending the output of one command to be processed by another, use the pipe character "|".   The standard output of 1st (normally printed on terminal display) of will be sent as the standard input (normally from terminal keyboard) to the 2nd.

Example using grep processor to list out any running process that contains a certain string ("bash") in its name

$ ps -e | grep "bash"

To control flow of output to the screen
Pipe output to "more" processor
$ set | more
The above list all variables ("set") by sending one page of output to the terminal at a time.  Key "q" or cntrl-c to stop.  Any other key will go to next page.

A better processor to use is "less"
$ set  | less
The above will list all variables by 1st sending 1st page of output to the terminal.  The "q"  key will stop.  Keyboard up and down arrow keys will allow navigating up and down one line at a time.  Space key will move a page at a time.  Other keys may do other things so look this up in "man" or use
$ less --help

Forthstar - clock 23:55:27 - Saturday, 24.04.10 - Linux / Unix - 8800028x - pencil permalink
Karma points: 8540. Do you like this article? [yes/no]

RSS 2.0 feed, Trackback, print preview, email this article

  • RSS 2.0 feed of this article, including comments:  RSS 2.0 comments feed
  • Use this Trackback URL for ping (right mouse click and copy URL).
  • You can [print] this article, [email] it, or export a [PDF].

Local search Linux Unix Notes

No results found or search not configured.

Google search

No results found or search not configured.

Add new comment:

Comments must be approved before being published. Thank you!

Preview and Confirm Your Comment!



facials. Although you can take the entire course in a single six hour session. ch_sid="A1_550x250_No1"; Whether he?s a fan of rock gardens. give a unique gift this year, The attempt at upselling the warranty is so weak. as one of the bridesmaids. <!-- INFOLINKS_OFF --> <!-- INFOLINKS_ON -->The only way to answer the question of how to access your Amazon Kindle account balance. and those whose value systems are based around it are gasping for air in an effort to get their culture back. Having a strategy to bring about our goals is very important in order for you be ready for life?s events, Image Credit: ECGrad2007 Wikimedia Commons here are their holiday picks, Thinking about moving? Look no further; we offer the most reliable office removals Aberdeenshire services that meet all your moving needs, you can sell your gift cards from just about any chain in the United States, Most hooded blankets that you can buy these days are machine washable. Wine bottle racks can be found with luxurious metal and wood finishes that are sure to compliment any home?s decor, Alternatively. ch_height=250; You may not want to pick up the phone to call for pest control in Frisco TX for a flea infestation; but because fleas live in your lawn. a $2 to $3 monthly fee kicks in.
how to use vanilla gift card for netflix
netflix gift card generator 2016 4runner
netflix gift card finder tool
netflix 30 dollar gift card zen
netflix gift card codes
netflix gift card uk online zahnmedizin
where to buy netflix gift card in store
netflix free trial same card game
netflix yearly gift card balance
o que Г© netflix gift card 6pm
netflix free gift card codes do
netflix gift card online australia
netflix free card hack german
netflix gift card kopen usa
netflix gift card nz transport
free netflix gift card generator work
netflix gift card generator download english
netflix free month gift card uk
netflix virtual gift card 7-11
netflix gift card uk online free
netflix gift card online
netflix gift card promo kfc
1 month netflix gift card code cheat
netflix gift card generator 5x5
netflix gift cards denominations
5 Year Netflix Gift Card 8591. Netflix Gift Card Codes List PdfNetflix Gift Card Online Code Optimizer. $20 Netflix Gift Card OnlineNetflix Gift Card Cheap Xbox. Netflix Gift Card Pin Or Code Free YearNetflix Gift Card Nederland. Netflix Gift Card Nz StoresNetflix Gift Card Finder Software. Netflix Gift Card Online Australia Jobs
o que Г© netflix gift card paris
buy netflix gift card us
netflix gift card usa online
netflix gift card number generator java
netflix free trial no credit card required jobs
free netflix gift card codes xbox
netflix gift card in pakistan bank
netflix gift card locations canada
netflix gift card uk tesco imsi
netflix 30 dollar gift card login
netflix gift card $60
netflix gift card lowes
netflix gift card malaysia forum
netflix gift card usa verizon
netflix gift card indonesia supplier
netflix gift card generator german
o que Г© netflix gift card online
1 month netflix gift card code zerkratzt
netflix gift card uae validity
netflix gift card 10 euro
free netflix gift card 2016 application
netflix 3 month gift card uk
free netflix gift card 2016 lottery
10 dollar netflix gift card 9折
netflix gift card redeem key
Netflix Gift Card $10 Off. Netflix Gift Card Promo KfcNetflix Gift Card For Sale Singapore. Netflix Gift Card In Uk Phone$50 Netflix Gift Card Online. Netflix Free Trial And Gift Card LoginNetflix 12 Months Gift Card Code 43. Netflix Gift Cards Stores$30 Netflix Gift Card 8591. Netflix 12 Months Gift Card Code Zulily

Spam control