How to change bash prompt?

So how do you setup, change and pimp out Linux / UNIX shell prompt?

Most of us work with a shell prompt. By default most Linux distro displays hostname and current working directory. You can easily customize your prompt to display information important to you. You change look and feel by adding colors. In this small howto I will explain howto setup:
a] Howto customizing a bash shell to get a good looking prompt
b] Configure the appearance of the terminal.
c] Apply themes using bashish
d] Howto pimp out your shell prompt

Partitioning disk for FreeBSD server

In this article I wish discuss some ideas about partitioning hard drive, when preparing PC for being FreeBSD server. For server install it’s necessary to make it as tight as possible.

When installing system, which main purpose will be running a few services - say, SMTP server or http proxy server, I prefer to use following partitioning:


swap - 2xRAM size, but not more than 1-2Gb
/tmp - 1-2Gb
/ - 6-8 Gb
/var -
/home- 1-2Gb
/data-

FreeBSD: Setting up USB and CD/DVD auto mount

You can use default FreeBSD automount daemon (amd) to automatically mount and unmount external storage devices as USB or CD-ROM.

Add all necessary devices to /etc/fstab with noauto option (which will prevent automounting them at startup). This 2 entries are for single USB mass storage device and CD-ROM.


/dev/acd0 /mnt/cdrom cd9660 ro,noauto 0 0
/dev/da0s1 /mnt/flash msdosfs rw,noauto 0 0

Create these directories


mkdir /mnt/cdrom
mkdir /mnt/flash

Ubuntu - Skype call recording

If you are using Skype on Ubuntu to communiate with others, you often need to record conversation.

I've tried different aplications and found the best one - Skype Call Recorder.

It's a small programm, which sits in a notification area (tray) and allows you to record current call.

 

You can setup it to record some conversation automagically as well.

Shell programming screencasts

$49.00

Shell programming made easy

 

You must program in Unix shell on your workplace? You want to make things work seamlessly and automagically?

You are in a right place to find answers to these questions.

 

You are looking here on educational course on shell programming.

It's shell programming course, starting from very basics of the shell and digging inside core of shell programming.

It's based on FreeBSD /bin/sh shell, which is very basic shell without all that fancy things, which bash have.

Mastering basic shell programming makes possible to write very universal scripts, which work in Solaris, AIX and HP-UX too.

And this is what required by most large corporates - because you MUST know, how to program on Solaris, and not on Linux bash shell.

 

That's why Im presenting you my shell programming course - which is already tested on several hundred people - ant all of them are quite satisfied. 

 

Tha main problem of Unix shell programming books

 

There are many books on Unix shell programming and even much more on shell usage, but they all have the same problem -- very steep learning curve.

They are trying to gove you as much as possible information on every chapter and THIS is The Main Problem.

I had a status of 'local unix guru next door' at several workplaces and I've faced the same approach everywhere.

People just come, ask one question, get the answer - how to do exactly that small thing, which they need, and then walk away. They are satisfied with answer they got. Usually they do not care about all remaining information - even if it's very useful. You can stop them from going away only by shouting at them - "Stop, dumb***, you will kick yourself in the head, if you do such and such thing!".

Something like saying - be very careful , doing "rm -rf /" - you will erase forever all your files.

You should return to the same subject again and again. It's like sowing the field with seeds. You first should go out and plough it up, then drill the seeds, then water the fields and so on. And every time you are going over the whole field again and again.

Quite the same thing applies to Unix shell learning. And it's even better - every time you cover more and more commands and usage cases.

 

What Is Inside?

Lesson 1 - Introduction (16:03)

Lesson 2 - Shell variables and scripts (23:44)

  • How "#!" magic works
  • How to make shell scripts runnable
  • How to fix strange 'Command not found' error
  • How the shell interpret the commands
  • Debugging and tracing shell scripts
  • Assigning values to variables
  • Using variables in shell
  • Substtuting commands with $VAR, ${VAR} - why should you use first one and second one

Lesson 3 - Quiting - single and double quotes, using backslash (19:31)

  • Using variables without quotes
  • Stripping extra whitespace from variables
  • Use variables with double quotes
  • Use variables with single quotes
  • Stripping 'enter' symbols from variables
  • Expanding shell patterns inside the quotes
  • What's the sequince of variable expansion?

Lesson 4 - Variable substitution, backtricks (13:07)

  • Using backtricks
  • Assigning sub-command output to variable
  • Doing arithmetic operations
  • Backtricks with double quotes
  • Backtrick with no quotes

Lesson 5 - Stdio, stdout, command error codes(17:52)

  • using 'read' command
  • parsing standard input
  • redirecting standard output of the commands
  • Using empty : command

Lesson 6 - Joining command together, pipes, command list (20:12)

  • Making command lists
  • How to separate commands in command lists
  • Combining commands - passing one command output of one command to the input of another command
  • Using 'cut' command
  • Making complex pipe sequences
  • Creating and debugging pipe sequences interactevly
  • Using 'sort' command
  • Using 'uniq' command

Lesson 7 - Conditional command execution (11:48)

  • How to conditinally join commands together
  • How to create ACTION1 , then ACTION2, then ACTION 3 and so on (AND operator)
  • How to create ACTION1 , if it fails -  ACTION2, if it fails ACTION 3 and so on (OR operator)
  • Common use cases of joining commands conditionally
  • Replacing if/then operator
  • Testing directory for existence

Lesson 8 - Reditrecting command input and output (36:00)

  • Using file instead of standard input
  • Input redirection
  • How convert input redirection to use pipes
  • How to convert pipes to input redirection
  • Using HERE-DOC redirection
  • Variable expansion in HERE-DOCs
  • Making text templates in shell scripts
  • Output redirection
  • Append to file
  • Redirecting standard error stream
  • Accessing current shell's process ID

Lesson 9 - Using subshell, subshell usage caveats (42:06)

  • Creatin subshell commands
  • Glueing several command output together
  • Writing scripts in subshell
  • Using variables in subshell
  • Communicating to the parent shell
  • Recognizing subshells in 'ps' output
  • Running subshell in background
  • Using subshell as a watchdog - terminating parent shell after timeout

Lesson 10 - Testing the conditions (24:12)

  • Testing command
  • /bin/[ command
  • /bin/test command
  • -eq comparison
  • -ne comparison
  • -lt comparison
  • -le comparison
  • -gt comparison
  • -ge comparison
  • Be careful when comparing strings
  • Comparing empty strings
  • Comparing strings together
  • Checking for file existense
  • Checinf for directory type
  • Checking for readable files
  • Checking for writable files
  • Checing for empty strings
  • Checing for empty files
  • Combining conditions together
  • Using AND and OR operators

Lesson 11 - Internal shell commands (21:22)

  • Making programm run in background
  • Shell jobs management
  • 'read' command
  • Redefining IFS variable
  • Splitting output by arbitrary symbol
  • Input redirect and while loop

Lesson 12 - 'if' operator (14:25)

  • true command
  • false command
  • if/then/fi operator
  • using external commands with if operator
  • if/then/else operator
  • writing if on single line
  • combining if operator with output redirection
  • Negating if condition
  • Redirecting standard input of if operator

Lesson 13 - 'while' operator (15:41)

  • while/do/done operator
  • running sript N times (using counter in loop)
  • creating infinite loops in shell
  • Redirecting while operator's input with pipes
  • Redirecting while operator's input with input redirection
  • Redirecting while operator's input with here-doc
  • Iterating over the list of predefined values in while loop
  • Combining here-docs, backtricks and while loop together
  • Using negation symbol in while

Lesson 14 - Understanding shell patterns (8:57)

  • Types of shell patterns
  • Match any symbol
  • Match only one symbol
  • Match some list of symbols
  • Exclude some symbols from matching
  • Examples of shell patterns

Lesson 15 - 'case' operator in shell (9:41)

  • using the 'case' operator
  • using shell patterns in comparison
  • default branch in case operator
  • Emulating grep operator in shell

Lesson 16 - 'for' operator in shell (10:42)

  • for/do/done operator
  • Loop over list of values
  • Caveats of defining loop values
  • Dealing with file with space in their name

 

You are also getting set of sample files, which are used as excersises in there screencasts.

 

Bonuses

 

Hey, you have some interesting bonuses with this screencasts.

Bonus 1 - Advanced shell programming article - emulating common external commands with shell

Get know, how to emulate cut, grep and other commands using only the shell. You will master the very advanced shell programming tricks to emulate external commands.

 

Bonus 2 - STOP! They are lying to you! 

Emulate arrays and associative arrays in EVERY shell.

You heard, that shells do not have arrays? They are lying to you, really.

With a few workaround tricks you can easily create and use arrays in every unix shell.

Read the article on creating arrays in shell.

 

Bonus 3 - Erase your negative emotional state in 1 minute!!! (audiocast)

  • You are frustated of your work conditions right now?
  • Your boss just shouted on you?
  • You had a conversation with a very annoying client a few minutes ago?

Get into shape very quickly and stop destroying your nervous system.

Listen to very simple, but yet very effective process -- and do it yourself.

It's as simple as 1-2-3 and includes 3 easy steps to perform.
 

Packaging

This products includes no phisical materials -- discs, books and etc.

After payment you will receive link to download archive with this screencasts and you will be subscribed to our mailing list - we will send you periodical updates and additions of this course.

 

Warranty

This product is covered with my 90-day unconditional return warranty.

You can return product at any time and get 100% refund.

$49.00

Starting educational courses on Unix shell

Hi there !  I'm starting educational courses in Unix shell programming.   There are lot of sujects to discuss, lot of very specific tips and tricks which come with experience and there is a lot of funny things which is possible to do with the shell.   Just stay tuned!

Syndicate content