Kick start with basic bash shell commands

##Kick start with basic bash shell commands

Depends on your network, SSH Bash Shell commands may be limited on host to host. Not every bash command may work especially which require privilege access. Usually most shell server are configured with basic need for PHP, Python, Perl and Java programmers. If you want more binary to execute on your shell environment, contact to your system admin or install one yourself.

Target Audience

  • Web hosting with SSH access to server
  • For a Window user
  • New Linux/Unix user
  • New Mac user
  • New to command line interface user

Basic BASH Commands

touch

touch — to create new file

joe

joe — joe command line text editor

Invoke commands insides joe editor (joe commands need to hold down control key while pressing two characters’ switches)

vi

vi — vi command line text editor

Invoke basic commands inside vi editor

nano

nano — nano command line text editor

CTRL+O (not zero, Control + Character O) — overwrite/modify text file
CTRL+X — to exit/quit nano editor

cat

cat — to view file contents

chmod

chmod — to change file permission

ls

ls — list current directory contents

Note: ll — is short form of ls -al. By default for limited user account or jailed user, this command is not enabled. You can create shell alias to use this command, read follow by alias section. -h option for viewing by KB/MB.

df

df — Report how much free disk space is available for each mounted disk.

du

du — Tells you how much space a file occupies.

clear — Clear Shell Screen

alias

alias — create your own shortcut commands with shell aliases.

rm

rm — remove/delete of files (use with caution!)

Switches

unzip

unzip — to unzip/inflating the zipped file

zip

  • In this example, filename.zip represents the file you are creating and filesdir represents the directory you want to put in the new zip file. The -r option specifies that you want to include all files contained in the filesdir directory recursively.

  • You can use zip to compress multiple files and directories at the same time by listing them with a space between each one:

bzip2/bunzip2

bzip2 — to compress/de-compress with bzip2 format

De-compress

Compress

  • You can use bzip2 to compress multiple files and directories at the same time by listing them with a space between each one:

gzip/gunzip

gzip — to compress/de-compress with gzip format

  • To use gzip to compress a file, type the following command at a shell prompt. The file will be compressed and saved as filename.gz.

  • To expand the compressed file, type the following command. The filename.gz is deleted and replaced with filename.

  • The following command compresses file1, file2, file3, and the contents of the /usr/work/school directory (assuming this directory exists) and places them in a file named filename.gz.

tar

tar — to inflate the tar archive file

tar — to create the tar archive file

mv

mv — move files to new place

cp

cp — copy files to new place

mkdir

mkdir — make new directory

wget

wget — direct download packages from shell to directory

curl

curl — direct download packages from shell to directory

Learn more

More about bash shell and its program commands