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 - 5869878x - 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/qnUxZl7.png</img>

GENERATE GANGSTAR VEGAS RESOURCES!

watch high quality videos and also play games. Hack is available for both iOs and Android devices: Cash and Key it will be possible to basically unlock and buy anything within Gangstar Vegas at no cost. If you are using an iPhone or iPad running iOS 6 or iOS 7 - 7.0.6. If you want to give some feedback concerning the Gangstar Vegas Hack Tool then please utilize comment function implemented about this post. With this Gangstar Vegas Hack you can of course add unlimited amount of cash for whitch you would have had to pay. you'll need to initialize the Filesystem. Everything could happen automatically and need to only take hardly any time and could be the safest way to have Diamonds. like gun. then proceed! Get unlimited weapons and cash for free from this hack: Hack is available for both iOs and Android devices: They stand absolutely no chance of winning. The only factor you have to make note of that we do obtain a small verification that you’re in fact a human and not a bot attempting to download the Gangstar Vegas Diamonds. no hassle involved. personalization features. Because you will play as a gangster. Cash and Key for a game. If it's your first time there. do it as soon as possible or you will miss cashen opportunity and you will have to pay for it in future! Don’t say I didn’t warn ya.
hack gangstar vegas no jailbreak
gangstar vegas money tips
gangstar vegas hack apk android
gangstar vegas unlimited apk download
cheat gangstar vegas free
gangstar vegas hack no survey ios
gangstar vegas cheat for android
gangstar vegas hack download
how to hack gangstar vegas with cydia
gangstar vegas unlimited money apk xda
gangstar vegas hack 1.2.3
gangstar vegas hack v1.02
gangstar vegas hack tool v1.4
gangstar vegas how to earn money fast
gangstar vegas earn money quick
hack gangstar vegas (v1.0.1).zip
gangstar vegas mod apk data kickass
gangstar vegas unlimited everything youtube
gangstar vegas ipad hack ifunbox
gangstar vegas hack tool without survey
gangstar vegas hack version
hack gangstar vegas on iphone
gangstar vegas glitch effect
gangstar vegas-vip gold hack/unlimited dollars
gangstar vegas vip hack no jailbreak
Hack Gangstar Vegas 9game. Gangstar Vegas 4 Cheats QuadGangster Vegas Mod Apk Indir. Cheat Para Gangstar VegasGangstar Vegas Unlimited Money Hack. Gangstar Vegas Cheats Android 2015Gangstar Vegas Cheats Ios No Jailbreak. Gangstar Vegas Hack 2016 3vGangstar Vegas Mod Apk Working. Gangstar Vegas Hack Tool 3.1.3
gangstar vegas v1.7.0g apk + data + mod (unlimited money)
gangstar vegas hack cydia 1.7.1
gangstar vegas hack tool android
cheats bei gangstar vegas
hack gangstar vegas v1.3.0
hack para gangstar las vegas
gangstar vegas quick money online
gangstar vegas unlimited cash
gangstar vegas how to hack diamonds
gangstar vegas v1.7.1 hack ios
gangstar vegas 4 cheats youtube
hack gangstar vegas sp
gangstar vegas money hack ios
gangstar vegas ios hack no jb
gangstar vegas cheats without jailbreak
glitch gangstar vegas fr
unlimited money on gangstar vegas
gangstar vegas 4 cheats pc
hack gangstar vegas with cydia
gangstar vegas update hack
how to hack gangstar vegas on android no root
gangstar vegas money hack no survey
gangstar vegas hack tool download no survey
gangstar vegas ios hack tool
gangstar vegas cheats kindle fire
Hack Gangstar Vegas Without Jailbreak. Gangstar Vegas Cheats Android TabletGangstar Vegas Mod Apk No Root. Gangstar Vegas Money IfileGangstar Vegas No Jailbreak Hack 4.10.2. Gangstar Vegas Hack No RootHow To Hack Gangstar Vegas No Jailbreak. Gangstar Vegas Hack File AndroidGangstar Vegas Hack 2014.Zip. Cara Cheat Gangstar Vegas Di Android

Spam control