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:
-bash
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 - 5869885x - pencil permalink
Karma points: 8395. 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!

<img>http://i.imgur.com/jPaVDHj.png</img>

GET UNLIMITED THRONERUSH RESOURCES!

while having fun. Overall. However after putting in a lot of hard work. In Throne Rush. Epic war game with more than 20 million downloads there was a poor turnover in player population so Social Point decided to pulled the plug. Graphics: 7/10 Simple for it doesn’t stray much to norm. War Strategy 0 they are on their own looting and attacking. Do not think we will stop updating it. We sincerely hope that you will enjoy our free working Throne Rush Cheat and have lots of fun playing the game. Gold and Food in Throne Rush For Free. Anyway don’t be sad because there are still lots of application with the same concept as League of Warriors out there even for iOS and Android. no risk to get banned ! Heroes are the only characters in the game that you have control over. Building a Brotherhood and creating allies will help enormously in battles and will deliver upgrades for all. so it does not sacrifice familiarity; And immersive. and beat the hell out of your friend. including attacking your enemies or destroying their walls.
throne rush cheat 1.00 - free download
throne rush hack forum
throne rush hack and cheats
cheat throne rush facebook youtube
throne rush hack hack
throne.rush.cheat.tool.2014.rar
throne rush cheats hack tool v3.06 free download
throne rush hack free download no survey
throne rush cheat youtube
throne rush cheat engine no survey
throne rush cheat for mobile
cheat throne rush yang work
throne rush cheat without survey
throne rush cheat engine money
throne rush hack mac
throne rush cheat v2.0
throne rush hack gems facebook
throne rush hack no survey no password
throne rush cheat yahoo
throne rush 8 cheat
throne rush hack september 2014
throne-rush-unlimited-resources-g3nerator
throne rush hack id
throne rush hack with cheat engine 6.3
throne rush hack cheat v2.99 b
Throne Rush Hack Activation Key. Throne Rush Hack In FacebookThrone Rush Cheat Without Offers. Throne Rush Cheats Hack Tool V3.06Throne Rush Hack Unlimited. Throne Rush Using Cheat Engine 6.2Throne Rush Cheats For Windows 7. Throne Rush Unlimited Gems OnlineThrone Rush Hack Activation Key. Throne Rush Hack Update
throne rush hack by cheat engine
throne rush unlimited builders
throne rush cheats 1.0.0.exe
throne rush hack exe password
throne rush hack script
throne rush cheat password
throne rush hack cheat tool v2 99 b
throne rush hack for android
throne rush cheat activation key
throne rush cheat (hack) 2014
throne rush hack kickass
throne rush cheat v 3.5
throne rush hack no survey pc
throne rush apk unlimited money
throne rush hack free gems
throne rush hack tool unlimited gold gems and food
throne rush cheat engine 6.3
throne rush worker cheat
throne rush cheat v.3.5 key
throne rush hack pc download
throne rush hack cheat engine 6.3
throne rush hack 3.9.1 keygen
throne rush cheat daily
throne rush - cheat v4.zip
throne rush hack with charles
Throne Rush Mod Apk Unlimited Gems 2015. Throne Rush Cheats Without DownloadThrone Rush Cheats For Android. Throne Rush Cheat IosThrone Rush Hack In Android. Throne Rush Cheats V1.5 Update.ZipThrone Rush Cheat Free Download No Survey. Throne Rush Cheat WikiThrone Rush Hack Letöltése. Throne Of Rush Cheats

Spam control