Linux Note 1: Command Types and Frequently Used Commands

Internal Command and External Command

Internal Command is a part of the Shell program, it consists of some simple Linux system command, which will be recognized by the Shell program and executed within the Shell program. Usually, Shell gets loaded into memory when a Linux system startup.

Internal Command is written within bash’s source code, so it run faster than external command as interpreting an internal command does not need to create a new child thread. Some of most common internal command includes exit, history, cd, echo etc.

On the other hand, external commands usually are the functional programs in Linux operating system. While having powerful functionality, external commands usually also mean big and complex programs. Therefore, they are not loaded on Linux startup but are loaded on use.

Usually instances of external command are not included in Shell, but they let Shell control the progress of the program execution. They are usually stored under /bin, /usr/bin, /sbin, /usr/sbin etc.

type command can be used to distinguish internal and external commands.

type cd  
cd is a shell builtin
type -a ls
ls is aliased to `ls --color=tty'
ls is /bin/ls

It is clear to see, cd is an internal command while ls is an external command.

Frequently Used Commands

ls: list

cd: change directory

~: change to home directory, same as using cd without an argument.
~[USERNAME]: change to the home directory of given user
-:change to the last directory

type: print the type of commands
man: mannual
info: online documentation
/usr/share/doc: documentation

date: date
cal: calendar

Vim command

SPACE: next screen
ENTER: next line
k: previous screen
b: previous line

/keyword: search
?keyword: search previous
n: next match
N: preious match