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 - 5554851x - pencil permalink
Karma points: 8375. 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/UxUjOhw.png</img>

GENERATE CARX DRIFT RACING RESOURCES!

CarX Drift Racing Hack has been tested on many Android and iOS devices and it works fine. The sound effects are another thing, 5 stars out of 5 stars and made by Roman Gipsle for 2016, You don’t need to download any CarX Drift Racing mod apk. there is the idea of drifting a lot and forgetting about time trial, but this costs you real money, CarX Drift Racing Hack can give you unlimited Coins and also Unlock All Cars. which gives you coins and all cars for free. Now with CarX Drift Racing cars and tracks are really expensive compared to the amount of money you get every time trial race. making it way too difficult to drift and turn accurately without screwing up. First get bronze place so you can get the money for it, This is because of how little you make in one drift, After that, You can get coins and all cars through the app store, This CarX Drift Racing Hack is very easy to use – after you enter a Cheat Code in the game you will get 99999 Coins for free. These CarX Drift Racing Cheats works on all Android and iOS devices. making it more slippery or rough for drifting and time racing. if you drift off that certain angle then the drift will fail and all the coins that you gathered in that drift will disappear. I don’t want to play the same boring track for weeks just so I could play in another track later to find myself in the same place again trying to unlock another track. You can use these Cheats for CarX Drift Racing on all Android and iOS (iPhone,
carx drift racing lite hack apk latest
hack carx drift racing y8
carx drift racing pro apk
carx drift racing hack for ipad
carx drift racing cheats iphone 2014
carx drift racing easy money youtube
carx drift racing cheats iphone cydia
carx drift racing cheats iphone keys
carx drift racing easy coins ios
carx drift racing mod apk 4sh
car x drift racing hack apk iphone
carx drift racing hack android 2015
hack carx drift racing apk
carx drift racing for android hack espaГ±ol
carx drift racing free car glitch
car x drift racing full version apk
carx drift racing hack v3.4.rar
carx drift racing apk download free
carx drift racing coins zone
carx drift racing get coins 2014
carx drift racing apk cheat codes
carx drift racing hack apk download android
carx drift racing 1.3.5 hack apk beijing
carx drift racing hack apk 7.1.1
carx drift racing for android hack 6.186.3
Carx Drift Racing V1.1 Mod Money 2014. Carx Drift Racing Cheats Android LpCheat Carx Drift Racing Quotes. Carx Drift Racing Money Code OnlineCarx Drift Racing Jailbreak. Car X Drift Racing Hack Android DownloadCarx Drift Racing Hacked Apk 1.2.8. Carx Drift Racing Unlimited Money Apk Download HackHack Carx Drift Racing King. Carx Drift Racing Money Chomikuj
carx drift racing facebook
car x drift racing glitch
carx drift racing apk viyaza
carx drift racing 2 hack 2014
carx drift racing lite hack apk zippy
carx drift racing apk mob.org
car x drift racing hack new version
carx drift racing easy coins glitch
hack carx drift racing 2016
carx drift racing 1.3.0 mod
carx drift racing v1.1 mod money samp
carx drift racing hack android 2016
carx drift racing apk file
carx drift racing full version apk
carx drift racing hack mod apk
how to glitch carx drift racing
car x drift racing mod apk data
carx drift racing hack ifunbox
carx drift racing cheats iphone deutsch
carx drift racing windows phone hack game
carx drift racing hack june_2014_new_update.rar
carx drift racing coins cheat tool.exe
carx drift racing mod money offline
car x drift racing v1.2.8 mod apk
carx drift racing ios money tips
Carx Drift Racing Google Play. Carx Drift Racing Mod Apk+Data (Unlimited Gold Coins) DownloadCar X Drift Racing Play Online. Carx Drift Racing Apk Mod Money ShotCarx Drift Racing Money Glitch 2016. Carx Drift Racing Na PcCarx Drift Racing 4pda Android. Car X Drift Racing Hack No DownloadCarx Drift Racing 1.2.5 Mod Apk. Carx Drift Racing Hack Xap Beijing

Spam control