Commands are used to do specific tasks in linux.Commands are always helpful in Linux administration support and If you are a good “commander” you can do anything in Linux! But its difficult to remember all the available commands , so use the help provided by linux , as mentioned in the previous chapter ð
Commands:
Everything on a linux system can be done by typing commands – playing music, browsing, chatting and what not.
Commands can be typed in virtual consoles, pseudo terminals (terminal emulators)
indisage@localhost:~$
$ usually means – logged in as a regular user
# usually means – logged in as root.
Don’t rely completely on the above statement of $ and #. They can be changed by changing the PS1 environment variable.
The Syntax:-
command -space- options -space- arguments
Command : ls , mv, cp
Options : -h , –help, –version, -V
Arguments : anything other than options passed to command
eg: ls -la /usr
Basic Commands:-
ls – -a, -F, -l, -1, -A, -t, -RÂ Â Â Â Â : lists the files
cd -> dir, /usr , . , ../, .. , –Â Â : change the directory
cp                                     : copy
mv                           : move
rm                             : remove
mkdir,rmdir -> -rf and -p options   : make a directory, remove a directory
more/less                  : file perusal filter for crt viewing, less is opposite of more
cat                                 : concatenate files and print on the standard output
head/tail                   : head-output the first part of files,tail-output the last part of files
find/locate/whereis/type –> -exec, -ok, -print0, -type, -uid, -inum, con?, con*, *.conf, “*.conf”, ?conf*
–> locate searches DB and full path, not just filename, while find is relatime and searches filename — -r , -i, -n
cut -f 1,4,5 -d “:” filename
clear                                : clear the screen/console
date/cal                   : to display the current date/calender
df                         : report file system disk space usage
finger                    : user information lookup program
man                      : an interface to the on-line reference manuals
nano/joe/vi/ed              : a text base editor’s
passwd                     : change user password
pwd                      : displays the present working directory
ifconfig                  : configure a network interface
init                       : process management daemon
ping                      : send ICMP ECHO_REQUEST to network hosts
ps                        : report a snapshot of the current processes.
rm/shred                 : remove files or directories/overwrite a file to hide its contents, and optionally delete it
route                     : show / manipulate the IP routing table
tracroute                  : traces route to a network host discovering MTU along this path
sudo                        : execute a command as another user
top                              : display Linux tasks
touch                             : change file timestamps
w/who/whoami             : Show who is logged on and what they are doing
which                     : locate a command
grep -> -r , -i , -n, -v ; man 7 regex ; egrep = grep -E : print lines matching a pattern
kill                         : send a signal to a process
talk/write/wall/mail         : send a message to another user
tar/cpio/gzip                 : The GNU version of the tar archiving utility, compress or expand files
split                             : split a file into pieces
Bash Keyboard Shortcuts :-
Ctrl + A – moves cursor to beginning
Ctrl + E – moves cursor to end
Ctrl + h / backspace – Deletes one character
Ctrl + c – Terminate the current executing command, if any and returns to shell
Ctrl + d – Logout
Ctrl + s – Screenlock
Ctrl + q – Unlock screenlock
Ctrl + w – Deletes last word
Ctrl + u – Deletes entire line
Ctrl + k – Clears command line from cursor position to end of line
Ctrl + y – pastes it back
Ctrl + T – Transpose the character on which the cursor rests and the preceding character.
Esc + TÂ – Transpose the word on which the cursor rests and the preceding word.
tab – Command / filename completion
Ctrl + R – reverse search on command history
Esc+F or Ctrl + -> – Moves right by a word
Esc+B or Ctrl + <- – Move cursor one word left
Ctrl + f or Right Arrow – Move cursor one position right.
Ctrl+B or Left Arrow – Move cursor one position left.
Alt + . and Esc + . – Picks up the arguments of the previous commands
Using Mouse in text mode:-
Copy:-
Left click – Start the selection
Drag – Select an area
Right Click : End the selection. Copied
Paste:-
Middle mouse button click
Happy Commanding ð