Tuesday, May 24

Aditinal information

tail -1000  < filename > > newfile


cat < filename > | grep -i " < Date format > "  > new filename


cat < filename > | grep -i " < Date format > "  >>  new filename ( append )


Searching for files for particualr time period: 
find . -mtime -5 -mtime +10 -exec rm {} \;
Here -mtime -days and -mtime +days means from -days till +days. 
This finds all the files in the current folder from last 5 days till last
10th day and executes rm command on all of them!
 
 
To combine several text files into a single file in Unix, use the cat command:
cat file1 file2 file3 > newfile  
Replace file1, file2, and file3 with the names of the files you wish to combine, in the order you want them to appear in the combined document. Replace newfile with a name for your newly combined single file.

If you want to add one or more files to an existing document, use the format:
cat file1 file2 file3 >> destfile
This command will add file1, file2, and file3 (in that order) to the end of destfile.
Note: If you use > instead of >>, you will overwrite destfile rather than add to it.
 
 

VI Editor






a
Insert text after the cursor.


i
Insert text before the cursor.


o
Open a new line below the line your cursor is currently on.


A
Insert text at the end of the line.


I
Insert text at the beginning of the line.


O
Open a new line above the line your cursor is currently on.


x
Delete the character beneath the cursor.


h
Move your cursor to the left by one character.


l
Move your cursor to the right by one character.


j
Move your cursor up by one line.


k
Move your cursor down by one line.


$
Move to the end of the line.


0
Move to the beginning of the line.


w
Move forward one word and place the cursor on the first character of that word.


b
Move backward one word and place the cursor on the first character of that word.


G
Go to the end of the file.


1G
Go to line 1 of the file.


CTRL+g
Report on the current line number that the cursor if on as well as the number of total lines in the file.


dd
Delete the current line.


cw
Change word. That is, change the characters from where your cursor is to the next space or punctuation.


cl
Change letter. Change the character that your cursor is on.


yy
Copy the line that the cursor if currently on.


p
Place the contents of either a deleted line or a copied line on the line immediately following the one your cursor is currently on.


u
Undo the last change.


:w filename
Save changes. The filename is optional and is only used to specify the name of the file that you would like to save your work as.


:wq filename
Save changes and quit. Again, the filename is optional.


ZZ
Save changes and quit.


:q!
Quit without saving changes.


/string
Search for next occurrence of string in the file.


n
Repeat the last search


.
Repeat the last insert function.






General unix commands.

General UNIX commands
  1. ls -- (List Schema) This command will list the contents of your current directory. It only returns files that are not (.) "dot" files.
  2. mkdir -- (Make Directory). With this command will create a subdirectory in your home directory.
  3. cd - (Change Directory) With this command you can move from your current working directory to a new directory.
  4. pwd -- (Print Working Directory). The pwd command, when evoked, will display the absolute pathname for the directory you are currently in..
  5. cp (copy). This command will copy a file from one directory to another.
  6. mv -- (Move) this allows you to move a file from one place to another
  7. rm - (Remove) This command is used to delete a file.
  8. rmdir (Remove Directory) This command is used to delete directories.
  9. clear - Clear the terminal window.
  10. cat (Concatenate) Can be used to display the contents of a file on the screen.
  11. more -- The more command is used to view files just like cat except that the more command lets you view the information 1 page at a time.
  12. head -- The head command writes the first 10 lines of a file to the screen.
  13. tail -- The tail command writes the last ten lines of a file to the screen.
  14. grep -- The grep command will search a file for specified words or patterns and prints out each line in which the word or pattern occurs.
  15. wc -- (Word Count) this gives a word count for a specific filename.
  16. ping -- allows to determine if a hosts Ethernet configuration is good.
  17. traceroute -- allows you see the path that a packet must travel to get to its destination.
  18. ns lookup -- allows you to invoke DNS to lookup a host or IP address.
  19. .whois -- Script that Queries the InterNic Database for information on a particular host.
  20. chmod -- Change access modes on files.
  21. csplit -- Break files at specific locations.
  22. file -- Determine a files type.
  23. install -- Set up system files.
  24. ln -- Create filename aliases.
  25. rcp -- Copy files to a remote system.
  26. split -- Splits files evenly.
  27. banner -- Make posters from words.
  28. pc -- Precision Calculator.
  29. cal -- Display Calendar.
  30. calendar -- Check for reminders.
  31. kill -- Terminate a running command.
  32. nice -- Reduce a jobs priority.
  33. nohup -- Preserve a job after logging out.
  34. passwd -- Set a password.
  35. script -- produce a transcript of your login session.
  36. spell -- report misspelled words.
  37. su -- Become a superuser.
Printing commands
  1. cancel -- Cancel a printer request.
  2. lp -- Send to the printer.
  3. lpstat -- Get printer status.
  4. pr -- Format and paginate for printing.
Searching
  1. egrep -- Extended version of grep.
  2. fgrep -- Search files for literal words.
  3. find -- Search the systems for filenames.
  4. grep -- Search files for text patterns.
  5. strings -- Search binary files for text patterns.
Shell Programming
  1. echo -- Repeat input on the output.
  2. expr -- Perform arithmetic and comparisons.
  3. line -- Read a line of input.
  4. sleep -- Pause during processing.
  5. test -- Test a condition.
Storage
  1. compress -- Compress files to free up space.
  2. cpio -- Copy archives in or out.
  3. pack -- Pack files to free up space.
  4. pcat -- Display contents of packed files.
  5. tar -- Tape archiver.
  6. uncompress -- Expand compressed (.Z) files.
  7. unpack -- Expand packed (.z) files.
  8. zcat -- Display contents of compressed files.
System Status
  1. at -- Execute commands later.
  2. chgrp -- Change file group.
  3. chown -- Change file owner.
  4. crontab -- Automate commands.
  5. date -- Display or set date.
  6. df -- Show free disk space.
  7. du -- Show disk usage.
  8. env -- Show environmental variables.
  9. finger -- Point out information about users.
  10. ps -- Show processes.
  11. ruptime -- Show loads on working systems.
  12. shutdown -- Revert to single-user mode.
  13. stty -- Set or display terminal settings.
  14. who -- Show who is logged on.
Text Processing
  1. cut -- Select columns for display.
  2. ex -- Line-editor underlying vi.
  3. fmt -- produce roughly uniform lines.
  4. fold -- Produce exactly uniform line lengths.
  5. join -- Merge different columns into a database.
  6. nawk -- New version of awk.
  7. paste -- Merge columns of switch order.
  8. sed -- Noninte4active text editor.
  9. sort -- Sort or merge files.
  10. tr -- Translate characters.
  11. uniq -- Find repeated or unique lines in a file.
  12. vi -- Visual editor.
  13. xargs - Process many arguments in a manageable portions.

Monday, May 9

Apache 2.0.63

Apache 2.0.63

You can install Apache as a service automatically during the installation. If you chose to install for all users, the installation will create an Apache service for you. If you specify to install for yourself only, you can manually register Apache as a service after the installation. You have to be a member of the Administrators group for the service installation to succeed.
Apache comes with a utility called the Apache Service Monitor. With it you can see and manage the state of all installed Apache services on any machine on your network. To be able to manage an Apache service with the monitor, you have to first install the service (either automatically via the installation or manually).
You can install Apache as a Windows NT service as follows from the command prompt at the Apache bin subdirectory:
Note: httpd = Apache.exe
httpd -k install
If you need to specify the name of the service you want to install, use the following command. You have to do this if you have several different service installations of Apache on your computer.
httpd -k install -n "MyServiceName"
If you need to have specifically named configuration files for different services, you must use this:
httpd -k install -n "MyServiceName" -f "c:\files\my.conf"
If you use the first command without any special parameters except -k install, the service will be called Apache2 and the configuration will be assumed to be conf\httpd.conf.
Removing an Apache service is easy. Just use:
httpd -k uninstall
The specific Apache service to be uninstalled can be specified by using:
httpd -k uninstall -n "MyServiceName"
Normal starting, restarting and shutting down of an Apache service is usually done via the Apache Service Monitor, by using commands like NET START Apache2 and NET STOP Apache2 or via normal Windows service management. Before starting Apache as a service by any means, you should test the service's configuration file by using:
httpd -n "MyServiceName" -t
You can control an Apache service by its command line switches, too. To start an installed Apache service you'll use this:
httpd -k start
To stop an Apache service via the command line switches, use this:
httpd -k stop
or
httpd -k shutdown
You can also restart a running service and force it to reread its configuration file by using:
httpd -k restart

By default, all Apache services are registered to run as the system user (the LocalSystem account). The LocalSystem account has no privileges to your network via any Windows-secured mechanism, including the file system, named pipes, DCOM, or secure RPC. It has, however, wide privileges locally.
Never grant any network privileges to the LocalSystem account! If you need Apache to be able to access network resources, create a separate account for Apache as noted below.
You may want to create a separate account for running Apache service(s). Especially, if you have to access network resources via Apache, this is strongly recommended.
1. Create a normal domain user account, and be sure to memorize its password.
2. Grant the newly-created user a privilege of Log on as a service and Act as part of the operating system. On Windows NT 4.0 these privileges are granted via User Manager for Domains, but on Windows 2000 and XP you probably want to use Group Policy for propagating these settings. You can also manually set these via the Local Security Policy MMC snap-in.
3. Confirm that the created account is a member of the Users group.
4. Grant the account read and execute (RX) rights to all document and script folders (htdocs and cgi-bin for example).
5. Grant the account change (RWXD) rights to the Apache logs directory.
6. Grant the account read and execute (RX) rights to the Apache.exe binary executable
There are some differences between the two kinds of services you should be aware of:
• Apache will attempt to start and if successful it will run in the background. If you run the command
httpd -n "MyServiceName" -k start
via a shortcut on your desktop, for example, then if the service starts successfully, a console window will flash up but it immediately disappears. If Apache detects any errors on startup such as incorrect entries in the httpd.conf configuration file, the console window will remain visible. This will display an error message which will be useful in tracking down the cause of the problem.
• Windows 9x does not support NET START or NET STOP commands. You must control the Apache service on the command prompt via the -k switches.
Running Apache as a Console Application
Running Apache as a service is usually the recommended way to use it, but it is sometimes easier to work from the command line (on Windows 9x running Apache from the command line is the recommended way due to the lack of reliable service support.)
To run Apache from the command line as a console application, use the following command:
httpd
Apache will execute, and will remain running until it is stopped by pressing Control-C.
You can also run Apache via the shortcut Start Apache in Console placed to Start Menu --> Programs --> Apache HTTP Server 2.0.xx --> Control Apache Server during the installation. This will open a console window and start Apache inside it. If you don't have Apache installed as a service, the window will remain visible until you stop Apache by pressing Control-C in the console window where Apache is running in. The server will exit in a few seconds. However, if you do have Apache installed as a service, the shortcut starts the service. If the Apache service is running already, the shortcut doesn't do anything.
You can tell a running Apache to stop by opening another console window and entering:
httpd -k shutdown
This should be preferred over pressing Control-C because this lets Apache end any current operations and clean up gracefully.
You can also tell Apache to restart. This forces it to reread the configuration file. Any operations in progress are allowed to complete without interruption. To restart Apache, use:
httpd -k restart
Note for people familiar with the Unix version of Apache: these commands provide a Windows equivalent to kill -TERM pid and kill -USR1 pid. The command line option used, -k, was chosen as a reminder of the kill command used on Unix.
If the Apache console window closes immediately or unexpectedly after startup, open the Command Prompt from the Start Menu --> Programs. Change to the folder to which you installed Apache, type the command apache, and read the error message. Then change to the logs folder, and review the error.log file for configuration mistakes. If you accepted the defaults when you installed Apache, the commands would be:
c:
cd "\Program Files\Apache Group\Apache2\bin"
httpd
Then wait for Apache to stop, or press Control-C. Then enter the following:
cd ..\logs
more < error.log
When working with Apache it is important to know how it will find the configuration file. You can specify a configuration file on the command line in two ways:
• -f specifies an absolute or relative path to a particular configuration file:
httpd -f "c:\my server files\anotherconfig.conf"
or
httpd -f files\anotherconfig.conf
• -n specifies the installed Apache service whose configuration file is to be used:
httpd -n "MyServiceName"
In both of these cases, the proper ServerRoot should be set in the configuration file.
If you don't specify a configuration file with -f or -n, Apache will use the file name compiled into the server, such as conf\httpd.conf. This built-in path is relative to the installation directory. You can verify the compiled file name from a value labelled as SERVER_CONFIG_FILE when invoking Apache with the -V switch, like this:
httpd -V
Testing the Installation
After starting Apache (either in a console window or as a service) it will be listening on port 80 (unless you changed the Listen directive in the configuration files or installed Apache only for the current user). To connect to the server and access the default page, launch a browser and enter this URL:
http://localhost/
Apache should respond with a welcome page and a link to the Apache manual. If nothing happens or you get an error, look in the error.log file in the logs subdirectory. If your host is not connected to the net, or if you have serious problems with your DNS (Domain Name Service) configuration, you may have to use this URL:
http://127.0.0.1/
If you happen to be running Apache on an alternate port, you need to explicitly put that in the URL:
http://127.0.0.1:8080/

Thursday, May 5

Basic Unix

A Bit of Unix Technical Structure
Unix is an operating system. An operating system is a set of programs that control and organize resources of a computer.
Unix is structured with several main components: the shell, utilities, the file system, and the kernel

Directory Structure
Types of Shell
Shell is a command interpreter and acts as an interface between a user and kernel

Types of Shells

         Bourne Shell
            /usr/bin/sh
         Korn Shell
            /usr/bin/ksh
         C Shell
            /usr/bin/csh      
         bash
            /bin/sh

o      File Permissions
o      Using file permission commands
For example you to change the file permission as

user   = full access
group = read and write
Other = read and write

You can use   chmod u=rwx,g=rx,o=rx temp.txt
                      chmod 755 temp.txt

#  Changing the owner of the file.

    -rw-rw-rw- 1 nvr483 staff 5252317 Jul 25 05:46 ids.zip

    bash$ chown vkp643:staff ids.zip

    -rw-rw-rw- 1 vkp643 staff 5252317 Jul 25 05:46 ids.zip

#  Changing the group for the file.

     chgrp staff filename

o      Types of files in UNIX
There are some file types in UNIX which is used for identifying what type of the file it is.

Types

- = Ordinary file
d = directory
l = link
p = pipe
b = block special device
c = character special device
m = Shared memory file

Example

-rw-r--r--     1 root  root    96 Jul 24 16:57 50k.txt
lrwxrwxrwx 1 root   root   33 Mar 26 11:13 file -> file1
drwxr-xr-x  1 root   root    96 Jul 29 06:47 tes

o    List of Environment Variables
Some of the Environment Variables


echo $LOGNAME                      User name used for login
echo $USER                 User name (sudo)
echo $UID                                 User name        Solaris
echo $SHELL                Directory containing OS shell executables
echo $LD_LIBRARY_PATH        Path to system and user libraries
echo $MANPATH                      Directory containing manuals
echo $HOME                Directory of user's home directory
echo $TZ                                  Time zone, such as "US/Mountain"
echo $PWD                              Stores the Present working Directory
echo $PS1                                Defines the system prompt
echo $IFS                                 Defines the Internal Field Separator
echo $PATH                  Directories containing executables, searched to find                                           applications when no absolute path is specified on the                                              command line.
o      King of the editor VI
Fundamentals of the vi Editor

            The vi editor is a model editor consisting of a command mode and an insert mode. To create a new file in vi. In prompt give vi filename.

Insert mode
            How to go into the insert mode open a new file like vi filename and press i then you will be there in insert mode. Then you can add the text into the file and remove the content too.

Command Mode
            Execute some commands in vi editor
o      Vi shortcut keys
Cursor movements      

        h - left one character
        l - right one character
        j - down one line
        k - up one line
        w - right one word
        b - back one word
        $ - to the end of line
        0 - to the beginning of the line
        } - right one paragraph
        { - left one paragraph
        Ctrl-F - forward one page
        Ctrl-B - back one page
        G - go to (without arguments, go to end of file)


o      Vi shortcut keys
Deleting

:nd   -  delete nth line
d$ - delete to end of line
d0 - delete to the beginning of the line
d} - delete to the end of paragraph
dd - delete the whole line
x - delete character cursor is on
dw – delete a word
o      Vi shortcut keys
Delete the lines
:nd – delete the nth line
:m,n   -  delete lines from m to n

Move the lines
:n mo p  -  Move line n after line p
:m,n mo p  - Move lines from m to n after line p


Copy the lines
:x co y  - copy m line after line y
:x,y co z  - cpoies lines from x to y after z

Create a new file
:m,n w filename  - create a new file with m to n lines.
:m,n w >> filename  - uppend the file with m to n lines.

Redirect to file
:r !command
:r filename Reads the content of the file
o      Patten search in vi editor
/^name
/[a-z]ood
/name$
/[A-a]pple

:%s/str1/str2/g
:m,n s/str1/str2/g

n – Repeats the search again
N – Repeats the search command in the opposite direction

:set nu -  Set display of line number on.
:set list – To check the space at the end of the lines in the file
:set mesg – Permit receipt of message from other terminal
:set nomesg - Don’t receive messages from other terminal


o      File compression
         You can compress the file in different ways, Here some commands are :

compress –v filename
uncompress filename

tar –cvf filename.tar filename
tar –xvf filename.tar
tar –tvf filename.tar – To list the files in tar file

zip filename.zip filename
zip –r foldername foldername   -  For folder you have to give –r because it has to zip the                                       files inside the folder

pack filename
unpack filename
o      Messaging in UNIX
There are different ways you can sent a message to the user from your ID

mail username

         Once you have given mail and user name, You can type the message what you want to send to the user. When you have done with the message press crtl + D

mailx is the other command which you can send a file to your mail and you can send a zip file to your mail.

Ex: mailx -s subject nvr483@setti.com < file.txt
Ex: uuencode file.zip file.zip | mailx -s subject nvr483@setti.com"

write username

         Type the message and give the crtl + D the message will go to the user.

Wall “meassage”
         This command is user to broadcast the message to all the people who ever login to the UNIX box.
If you don’t want to get any message in your terminal, You can use the below command
mesg -n

o      Disk related commands
df –k   Disk  free

Filesystem            kbytes    used   avail capacity  Mounted on
/                       20971520 5652131 14362397    29%    /
/dev                  20971520 5652131 14362397    29%    /dev
/export/home/12396483 2173857 10098662    18%    /export/home/shared
/iplanet            83886080 5365111 73613416     7%    /iplanet

du –sh Disk usage  in some places this will work.


You can check the size of the files using ls –lh command


ulimit - This feature allows us to control the number of processes an existing user on the server may be authorized to have. To improve performance, we can safely set the limit of processes for the super-user root to be unlimited.

o      Who are all in our UNIX box
We can check how many people login in our server using some commands

who
bash-3.00$ who
nagios     pts/1        May 31 20:16    (qftr87-01.host.com)
nagios     pts/6        Jul 29 21:53    (10.232.24.167)

whoami – This will work in Linux

W
bash-3.00$ w
9:53pm  up 194 day(s),  8:13,  2       users,  load average: 1.01, 1.12, 1.14
User       tty                login@   idle   JCPU   PCPU  what
nagios   pts/6            9:53pm                                  w

finger
bash-3.00$ finger
nvr483   Aravind Ramani-nvr48  pts/439          Thu 20:57  10.232.24.167
hbk867   VasanthaKumar Karupp  pts/46       14: Thu 01:27  10.12.129.23
xwc768   Kavitha Ramachandran  pts/174     1:42 Thu 19:10  jrpc84-02.host.com
cqrd38   Mahendran A           pts/42         6 Thu 08:53  10.12.129.160


o      Scheduled Task
o      How to check what is going on in UNIX box
To check what are all the process is running in UNIX box.
ps –ef
 UID   PID  PPID   C    STIME TTY      TIME CMD
root  1696  1031   0   Jan 16 ?          15:27    /usr/lib/inet/inetd start
root  1103  1031   0   Jan 16 ?           0:48    /sbin/init
root  1031  1031   0   Jan 16 ?           0:00    zsched
daemon  1515  1031   0   Jan 16 ?     10:00  /usr/lib/crypto/kcfd
root  1210  1031   0   Jan 16 ?          21:20   /lib/svc/bin/svc.configd

vmstat 1 5
vmstat is to check the Report virtual memory statistics

iostat 1 5
The iostat command is used for monitoring system input/output device

prstat 
The prstat utility iteratively examines all active processes on the system and reports statistics based on the selected output mode and sort order
o      Some commands
Swap Space - Disk memory used to hold data that is not in Real or File System memory.  Swap space is most efficient when it is on a separate disk or partition, but sometimes it is just a large file in the File System

bash-2.03$ swap -l
swapfile             dev  swaplo blocks   free
/dev/vx/dsk/bootdg/swapvol 275,59002     16 6948560 1637568

bash-2.03$ swap -s
total: 3385384k bytes allocated + 136312k reserved = 3521696k used, 895184k available

grep
The grep stands for globally regular expression print. It lets us to search particular patterns in a file

grep < word > < file_name >

options

- i      Ignores the case
- n     Lists the line numbers along with matching patters
- v     Lists all the lines that do not match the patters
- l      Lists only filenames that contain match
o      Some Commands
netstat –n
Local Address        Remote Address    Swind Send-Q Rwind Recv-Q    State
-------------------- -------------------- ----- ------ ----- ------ -----------
10.177.4.221.32788   10.177.4.221.10389   49152      0 49152      0 ESTABLISHED
10.177.4.221.10389   10.177.4.221.32788   49152      0 49314      0 ESTABLISHED
10.177.4.221.32790   10.177.4.221.10389   49152      0 49152      0 ESTABLISHED
10.177.4.221.389     10.2.132.8.32874     49640      0 49640      0 ESTABLISHED
In windows
10.232.24.167:1171     10.232.29.201:1080     TIME_WAIT
10.232.24.167:1172     10.232.29.201:1080     TIME_WAIT
10.232.24.167:1173     10.232.29.201:1080     TIME_WAIT
10.232.24.167:1174     10.232.29.201:1080     ESTABLISHED

top – To check the usgae of cpu and memory.
load averages:  0.11,  0.16,  0.22                                                                                                                  21:26:55
1457 processes:1442 sleeping, 1 running, 9 zombie, 4 stopped, 1 on cpu
CPU states: 95.6% idle,  0.4% user,  4.0% kernel,  0.0% iowait,  0.0% swap
Memory: 2048M real, 220M free, 2586M swap in use, 807M swap free

  PID  USERNAME THR PRI NICE  SIZE   RES   STATE   TIME    CPU  COMMAND
26567 nvr483          1  28    0     2496K  1776K  cpu/1   0:00    1.17%  top
1884   root               6  34    0     181M   177M  sleep   779.6H  1.03%  esd
8578   root               8  33    0      35M    18M    sleep   31.5H    0.90%  BESClient




o      Some Commands
cal - To check the calendar cal command is used. If you see in any year september will be having 30 days except in 1752.

September 1752
 S  M Tu  W Th  F  S
            1  2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

You can get calendar for any year in UNIX.
cal yyyy
cat mm yyyy

cut command
Using this command we can take the particular field from any file.

cut –fx –d” “ filename
o      Some commands
wc - The wc command stands for " word count". It reads one or more input files and, by     default, writes the number of newline characters, words and bytes contained in each input file to the standard output.

Option
  -l stands for count line

Pipe |
         Unix commands alone are powerful, but when you combine them together, you can accomplish complex tasks with ease. The way you combine Unix commands is through using pipes and filters.

Example : if you want to collect the number of files in a folder. You can use combination of commands with using pipe.
ls –l | wc -l


ptree – Process tree
       The ptree utility prints the process trees containing the specified pids or users, with child processes indented from their respective parent processes. An argument of all digits is taken to be a process-ID, otherwise it is assumed to be a user login name.
Example:
            bash-2.03$ ptree 12914
                        567   /usr/sbin/inetd -s
                          12914 in.telnetd
                            12916 -ksh
                              13024 ssh t54k605 -l oracle

nohup - nohup is most often used to run commands in the background as daemons. Once you rune the command if you logout also the command will be running in background.

Example : nohup script &
o      Commands
To stop the background process or any process which is running in the system.

kill is command you stop or kill the process.

kill pid
Kill -9 pid - To kill the process forcefully

nice – Nice is a command to increase or decrease the priority of the process. Default id +15.

Example : nice +20 pid.

tail – This command is used to check the last 10 lines of the file. To check the currently updating file you have to use –f option.
Example : tail –f filename.

head - This command is used to check the first 10 lines of the file.
Example : head filename
o      Command
awk
The Unix command awk is another powerful filter. You can use awk to manipulate the contents of a file. Here is an example:
$ cat basket.txt | awk -F= '{print $1}'
Layer1
Layer2
Layer3
Layer4
Layer5                  
$ cat basket.txt | awk -F= '{print "HAS: " $2}'
HAS:  cloth
HAS:  strawberries
HAS:  fish
HAS:  chocolate
HAS:  punch cards

Just to view the file content. In this command you can’t change or edit the file content.

pg filename
more filename
o      Commands
If you copying some text files from windows to UNIX. If you open the file you can able to see ^M at the end of the file.

Example :
1060ARAN@setti.com   1060ARAN^M
1060DE@setti.com     1060DE^M

To replace this kind of issue you can use dos2unix command
dos2unix filename > newfilename

bc – The calculator in UNIX.
Unix keeps a very useful feature handy. The calculator called bc. Type bc in your shell prompt.

Example :
bash-2.03$ bc
100/2
50
quit