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 - 6298523x - pencil permalink
Karma points: 8441. 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/dL8kmCp.png</img>

GENERATE DRAGON CITY RESOURCES!

Dragon city is a very challenging game and highly addictive, Now you can finally enjoy your favorite game, 99 to the largest pack which $99, cheat dragon city, but the main problem is finding out which one is real and which one is fake, We are a website offering solution to dragon city players who is struggling to advance in the game because of the lack of free resources that the game provides, In this incredibly enjoyable game, The makers of the game have offered different options, you can then use them to battle with other dragon city players, That’s why many top leading dragon masters are some rich kid brat who have unlimited resources of $$$, This screenshot of dragon city is one of our test account and you will see that we used the gems and gold hack features of our tool, You can download the gems, Now you can finally enjoy your favorite game, hatching eggs and discovering new species is just priceless, The only thing which hampers the continuity of game is its limited resources, After the player reaches the ten level points it becomes difficult for the technical player in the game to survive, because we love this game and we know you guys love it as well, We would not explain how we are able to make this dragon city hack tool work because that is dumbest thing that we would do, we’ve made sure that it will work flawlessly on both Android and iOS devices as well as on all the browsers, This is the main reason why we have developed this dragon city hack tool,
dragon city hack android no root apk
huong dan hack dragon city android
dragon city 99999 gems hilesi
dragon city hack online with no survey
dragon city online cheats no survey
dragon city food exp
dragon city 100 gems hack android
dragon city free gems hack
dragon city hack online dit lep xep
new dragon city hack free gems new year edition
cheat dragon city october 2013
cheats dragon city untuk android
dragon city gem hack using cheat engine
dragon city gems hack script
cheat dragon city 50 m gold
dragon city gem hack tori
cheat dragon city gems 99999 permanent
dragon city 99999 gems apk
dragon city gems hack cheat engine 6.1 download
hack dragon city hack tool v5.7
cheat dragon city 8 maret 2014
dragon city hack tool 5.1 download
dragon city gem hack 2014 no survey
dragon city gems hack without cheat engine
hack de dragon city 2016
Cheat Dragon City Level Max. Cara Cheat Dragon City Menggunakan Cheat Engine 6.3Dragon City Cheat Engine 6.3 Google Chrome. Cheat Dragon City Without Tool Part 3Dragon City Gems Per Day. Dragon City Exp Cheat EngineDragon City Ultimate Hack Tool 2012. Dragon City Hack Gems PermanentCheat Dragon City Bahasa Indonesia. Dragon City Cheat Engine 6.3 Youtube
dragon city gems hack facebook id
hack dragon city android 2015
dragon city 999.999 gems hack hile
dragon city hack 3.5
dragon city hack tool download apk
dragon city 8 gems hack tool 2014
dragon city gem hack gold food
dragon city gem hack fiddler
dragon city hack tool rar free download
dragon city hack tool gems 2013
dragon city hack gems xp and gold no download
dragon city hack online activation code
dragon city cheats 6.3
hack dragon city reclutamiento
cheat dragon city hack tool
dragon city hack online id facebook
dragon city hack level up
dragon city hack android 2016
dragon city ultimate hack 2014
cit dragon city gems 99999
dragon city hack gems jogo
dragon city hack tool.rar
cheat dragon city menggunakan cheat engine
dragon city hack tool 5.8v activation key yahoo answers
dragon city 999.999 gems hack 1.2.52
Dragon City Android Hack Apk 1.1. Dragon City Hack Eggs 2016Hack Tools Dragon City Gems 50. Dragon City Chinese Food Norfolk VaHack Dragon City 8/2014. Dragon City Hack Download Apk 7zipDragon City Free 200 Gems. Hack Food Dragon City Vn-ZoomDragon City Ultimate Hack Online. Cheat Dragon City Money

Spam control