FILE HANDELING COMMAND

* To Make Directories --->mkdir [OPTIONS] DIRECTORY

Example :
mkdir xyz
* To Change Directories --->cd DIRECTORY
Example :
cd xyz
* To List Directories Contents --->ls [OPTION].. [FILE]..
Example :
ls xyz
ls -a ->do not ignore the entries starting with .
ls -l ->use a long listing Format
ls -r ->Reverse order while sorting
ls -R ->List subdirectories recursively
ls -s ->print the allocated size of each file, in block
ls -S ->Sort by File size
ls *.txt --> prints all text files
* To Print name of current/working directory --->pwd [OPTION]...
Example :
pwd
* To Edit Program --->vi [OPTIONS] [FILES..]
Example :
vi file1.txt

To exit vi and save changes-> ZZ or :wq
To exit vi without saving changes-> :q!
To save changes without exit vi-> :w
To enter vi command mode-> [esc]

Insert before cursor-> i
Append after cursor-> a

Delete character under cursor-> x
Delete line under cursor-> dd
Delete word under cursor-> dw
* To Copy files and directories --->cp [OPTIONS] SOURCE DEST
Example :
cp sample.txt sample_copy.txt
cp sample_copy.txt target_dir
* To Rename SOURCE to DESTINATION or move SOURCE to DIRECTORY --->mv [OPTION] SOURCE DEST
Example :
mv old.txt new.txt
mv source.txt target_dir
* To Remove file or directories --->rm [OPTION] FILE..
Example :
rm file1.txt
rm -rf some_dir
-r -->remove directories and their content recursively
-f --> ignore nonexistent files, never prompt
* To search files in a directory hierarchy --->find [OPTION] [path] [pattern]
Example :
find -name file1.txt
* To Prints recently used command --->history
Example :
history




TEXT PROCESSING COMMAND

* To Concatenate the files and print on the standard output --->cat [OPTION]... [FILE]...

Example :
cat file1.txt file2.txt
* To Display a line of text --->echo [SHORT-OPTION]... [STRING]...
Example :
echo Afixi Technologies Pvt. Ltd
* To Print lines matching a pattern --->grep [OPTIONS] PATTERN [FILE...]
Example :
grep -i apple file1.txt
-i -> Ignore case distinctions in both the PATTERN and input files




SYSTEM ADMINSTRATION COMMAND

* To Change file mode bits --->chmod [OPTION]... MODE[,MODE]... FILE...

Example :
chmod 0777 file1.txt -> give read,write,execute permission for owner, group, and other
chmod -R 0777 sample_dir -> change permission of file and folder recursively
* To Change user ID or become superuser --->su [OPTION] [USERNAME]
Example :
su
* To Print the username associated with the current effective user ID --->whoami [OPTION]
Example :
whoami




ARCHIVAL COMMAND

* To tar a file --->tar [OPTION] DEST SOURCE

Example :
tar -czf home/sample.tar home/sample_dir --->make a file tar
tar -xzf home/sample.tar ---->make a file untar
-c ->Create a new archive
-z ->gzip format
-f ->use archive file or device ARCHIVE
-x ->extract a file
* To package and compress(archive) file
Example :
zip sample.zip sample_dir
* To list, test and extract compressed files in a ZIP archive
Example :
unzip sample.zip




NETWORK COMMAND

* To SSH client(remote login program) --->ssh [OPTIONS] [USER]@HOSTNAME

Example :
ssh parwesh@192.168.1.53
* To Install ncftp
Example :
sudo apt-get install ncftp
* To Connect ncftp --->ncftp -u uname domain_name
Example :
ncftp -u suchismita 192.168.1.86
* To Put on local from remote server
Example :
mget -R abc
* To Put on remote server from local
Example :
mput -R sample.txt
* For non-interactive download of files from the Web --->wget [OPTION] [URL]
Example :
wget http://www.way2tutorial.com/jquery/jquery_download.php




OTHER COMMAND

* To Open mysql command-line tool --->mysql -u USERNAME -h HOSTNAME -p

Example :
mysql -u parwesh -h 192.168.1.53 -p
* To Use a database ---> use DB_NAME
Example :
use afixi_pms