Unix Scripts
A Unix script is a program which is written in a programming language built into one of the Unix shells.
If you can type commands into the Unix shell, you can write a shell script. A shell script can be as simple as a text file containing a list of commands.
Let’s say that you frequently FTP to the server ftp.ox.ac.uk. You could create a Unix script called “ox” to FTP to that server automatically. This would save you typing everytime you connected.
Your simple Unix script could contain just this one line:
ftp ftp.ox.ac.uk
You could then execute your script by using the command “sh ox”, or you could set the file permissions of the script to allow it to be executed by typing just “ox”.
- How to Capture a Unix Terminal Session
One of the best methods to capture a Unix terminal session is to use the `script` command. In this example we start a script session, run a couple of commands, and then use the `exit` command to stop capturing the terminal session: $ script Script started, output file is typescript $ pwd /home/will $ ps [...]...
- How to Copy UNIX Files to Windows
For those computer users that have both Unix and Window’s operating systems, you should know that you can easily copy your Unix files from a Unix computer and transfer them to a Windows computer. Using Client for NFS, you can transfer any existing Unix files from your Unix server to a Windows based server. It [...]...
- How to Use the Unix Grep Command
The Unix grep command is a search command built into a variety of Unix based operating systems. This command line utility, whose name stems from the original Unix term which means “search globally for lines matching the regular expression, and print them,” can be accessed using the command line or terminal from anywhere in the [...]...
- How to Change a Unix Password
To change your Unix password, use the `passwd` command. Unless you are the “root” user, you will need to know your current password to set a new one. If you have forgotten your current password, you will need to contact the “root” user to have your password reset. Here is an example of the user [...]...
- .login
.login is a Unix shell script which is executed for a user every time that user logs in. A standard .login file will set important environment variables such as $PATH and may also run commands, such as `fortune`. The .login file will be stored in the users home directory. .login is used by the C [...]...





