Debian Work Environment

Valic —  June 10, 2013 — Leave a comment

You found out in a previous article that Midnight Commander allows you to do almost everything under Debian, but it is very important for you to become familiar with the work environment and to learn how to use the command line tools from the shell prompt. You are able to select your login shell using chsh. The list of shell programs may include: bash, tcsh, dash, zsh, pdksh, csh, sash, ksh, rc or posh. In this article we will use bash as the interactive shell. The bash behaviour can be customized from “~/.bashrc“. Under Debian work environment there are some key strokes, special ones, which have a special meaning, as you can see in the below list:

  • Ctrl-U will erase the line before cursor
  • Ctrl-H is used to erase one character before cursor
  • Ctrl-D will terminate exit shell
  • Ctrl-C used to terminate a running program
  • Ctrl-Z stops the program temporarily
  • Ctrl-S used for halt output to screen
  • Ctrl-Q will reactivate the output to screen

Mouse can be also used, and these operations are made using a 3 button mouse. Button functions are not different that a standard one. Please note that in order to use a mouse on a Linux console you must have gpm(8) as a daemon running. An enhanced pager, less(1), exists on this work environment. If you have not defined yet a default text editor under your Debian operating system, you will have to install one. VIM is recommended by most users. The default editor is located at ‘/usr/bin/editor‘ and can be properly invoked by other applications. Before installing one editor, please check what values you have for environment variables “$VISUAL” or “$EDITOR” and see what editor are you currently using.

If you need a mode to record the activities you make while using the shell prompt, in order not to lose forever what you wrote there or if you need to do a review of them sometime in the future (especially for those of you who are doing administrative tasks), this is the way to do it: type ‘script‘ in command line, make your commands, press ‘Ctrl + D’ to exit the script and then write ‘vim typescript’ which will show you the entire script history.

Now you are at that moment when you will have to learn some basic Debian commands in the editor. Execute the below command while logged in with a non privileged user:

  • pwd is used to display the name of the working directory
  • whoami will display the current username
  • id displays the current user identity
  • file <x> will display a type of file for the file “<x >”
  • ls lists the content of a directory
  • ls -a lists the contents of a directory but including all files and directories
  • mkdir x – make a new directory x
  • rmdir x – removes a directory x
  • top will display the current process information using full screen mode Continue Reading…

When you will start using the Bash shell more often, you will appreciate these shortcuts that can save you very much typing time:

Shortcut Description

Up/Down Arrow Keys

You can scroll back to an old command, hit ENTER, and execute the command without having to re-type it.

history command

Show your complete command history.

TAB Completion

If you type a partial command or filename that the shell recognizes, you can have it automatically completed for you if you press the TAB key.
Search your command history with


Press CTRL-R and then type any portion of a recent command. It will search the commands for you, and once you find the command you want, just press ENTER.
Scrolling the screen with Shift- PageUpandPage Down Scroll back and forward through your terminal.


Does the same as the up arrow
CTRL + N Does the same as the down arrow


Terminates the search function (escape does the same thing)
CTRL+ S Searchs forward in the command history.
CTRL + A Move cursor to start of line
CTRL+ E Move cursor to end of line
CTRL +B move backward within a line
CTRL + F move forward within a line
CTRL +D deletes characters and moves down the line
CTRL + K deletes the entire line
CTRL + X + backspace deletes all characters from cursors current position back
CTRL + T transpose text moves character down the li
ESC then c will convert the letter above the cursor to upper case
history –c will clear all of your history. Good for if your trying to hide command line passwords enetered.

Beginners – BASH Special Characters

Valic —  November 29, 2012 — 1 Comment

Before we continue to study about UNIX operating system shell commands, it is important to understand that there are several symbols and characters that the shell interprets in special ways called BASH Special Characters. This means that certain typed characters:

  • Cannot be used in certain situations
  • May be used to perform special operations
  • Must be “escaped” if you want to use them in a normal way.
Character Explanation


Escape character. If you want to reference a special character, you must “escape” it with a backslash.
Example: touch filename\* – This command will create the file filename*


Directory separator. It’s used to separate a string of directory names.
Example: /var/www/htdocs


Current directory


Parent directory


User’s home directory


Represents 0 or more characters in a filename or by itself, all files in a directory.
Example: sql*2012 can represent the files sql2012, sql-backup2012, sql29-11-2012 etc.


Represents a single character in a filename.
Example: filename?.txt can represent filename1.txt, filenamex.txt.


Can be used to represent a range of values,  [0-9], [A-Z], etc.
Example: filename[0-2].txt represents the names filename0.txt, filename1.txt, and filename2.txt


“Pipe” . It’s mostly used to redirect the output of one command into another command.
Example: ls | more


Redirects output of a command into a new file. If the file already exists will be over-writed.
Example: ls > listoffiles.txt


Redirects the output of a command onto the end of an existing file. If the file does not exist, will be created.
Example: echo “test ” >> testfile.txt


Redirects a file as input to a program.
Example: more < listoffiles.txt


Command separator. Allows you to execute multiple commands on a single line.
Example: cd /var/log ; less syslog


Command separator as above, but only runs the second command if the first one finished without errors.
Example: cd /var/logs && less syslog


Execute a command in the background, and immediately get your shell back.
Example: find / -name log > logfiles.txt &

What is a command shell:

Command shell is a program that interprets commands,
Allows a user to execute commands by typing them manually at a terminal or automatically in programs called shell scripts.
A shell is NOT an operating system.
It is a way to interface with the operating system and run commands.

What is BASH:

The name itself is an acronym, BASH = Bourne Again SHell
Bash is a shell written as a free replacement to the standard Bourne Shell /bin/sh originally written by Steve Bourne for UNIX systems.
BASH has all of the features of the original Bourne Shell plus additions that make it easier to program.
BASH is Free Software and was adopted as the default shell on most Linux distributions.

New category

Valic —  October 9, 2011 — Leave a comment

All posts in this category will be useful snippets of different categories such as: bash, linux, mysql, apache, htaccess, and why wordpress and more.