wordpres

Simple Commands & Shortcuts For The Linux Shell & OS X Terminal

This lesson from the Linux Academy will teach you a few simple, useful commands to help you while working and navigating the Linux shell. You will learn about the location of shell customization files as well as the history and command shortcuts on the command line.

You can also find a quick reference below of the command shortcuts. Feel free to bookmark and refer back to them as needed.




The Linux Bash Shell
A few shell commands

Time [command] – tells you how long the system took to execute the [command] command

pwd – shows current working directory
Set – various options for the Linux shell. Use this command to customize the shell.

Running Programs

exec myproc – Exec is used to execute a command when you want the program to replace the shell process. When the program terminates it will terminate the shell. Normally running a program by calling it’s location will start another process along the shell.

./program – will run the program named “program” inside of your current working directory (. means current working directory)

To run the program “program” located in /home/user/ type /home/user/program this will execute the program (. only executes if your in the working directory your current in).

You can execute a program just by typing the programs complete path inside of the shell. /home/user/program

Note: Program will only run if it’s marked as executable with permissions

Shell Short Cuts:
Crtl + R – in shell allows you to search .history file. (pressing repeatedly will keep searching till you find the command your looking for)
Crtl + P – Does the same as the up arrow
Crtl + N – does the same as the down arrow
Crtl + G – terminates the search function (escape does the same thing)
Crtl + S – Searchs forward in the command history.
Crtl + A – Move cursor to start of line
Crtl + E – Move cursor to end of line
Crtl +B – move backward within a line
Crtl + F – move forward within a line
Crtl +D – deletes characters and moves down the line
Crtl + K – deletes the entire line
Crtl + X + backspace – deletes all characters from cursors current position back
Crtl + T – transpose text moves character down the li

One thought on “Simple Commands & Shortcuts For The Linux Shell & OS X Terminal

  1. A couple shell shortcuts I found useful:

    Shift + PageUp = Scrolls terminal screen up
    Shift + PageDown = Scrolls terminal screen down

    tab = Auto completes what you’re typing, just type the first few letters of a filename, then press tab and the terminal will autocomplete it for you!

Leave a Reply

Your email address will not be published. Required fields are marked *