Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts
Redirection in Unix
Most processes initiated by UNIX commands write to the standard output (that is, they write to the terminal screen), and many take their input from the standard input (that is, they read it from the keyboard). There is also the standard error, where processes write their error messages, by default, to the terminal screen.
We have already seen one use of the cat command to write the contents of a file to the screen.
Now type cat without specifying a file to read
% cat
Then type a few words on the keyboard and press the [Return] key.
LEARN MORE>>
We have already seen one use of the cat command to write the contents of a file to the screen.
Now type cat without specifying a file to read
% cat
Then type a few words on the keyboard and press the [Return] key.
LEARN MORE>>
Unix Variables
Variables are a way of passing information from the shell to programs when you run them. Programs look "in the environment" for particular variables and if they are found will use the values stored. Some are set by the system, others by you, yet others by the shell, or any program that loads another program.
Standard UNIX variables are split into two categories, environment variables and shell variables. In broad terms, shell variables apply only to the current instance of the shell and are used to set short-term working conditions; environment variables have a farther reaching significance, and those set at login are valid for the duration of the session.
By convention, environment variables have UPPER CASE and shell variables have lower case names.
LEARN MORE>>
Standard UNIX variables are split into two categories, environment variables and shell variables. In broad terms, shell variables apply only to the current instance of the shell and are used to set short-term working conditions; environment variables have a farther reaching significance, and those set at login are valid for the duration of the session.
By convention, environment variables have UPPER CASE and shell variables have lower case names.
LEARN MORE>>
Unix Wild Cards Wildcards
The * wildcard The character * is called a wildcard, and will match against none or more character(s) in a file (or directory) name. For example, in your unixstuff directory, type
% ls list*
This will list all files in the current directory starting with list....
Try typing
% ls *list
This will list all files in the current directory ending with ....list
LEARN MORE>>
% ls list*
This will list all files in the current directory starting with list....
Try typing
% ls *list
This will list all files in the current directory ending with ....list
LEARN MORE>>
Unix Files
Copying Files
cp (copy)
cp file1 file2 is the command which makes a copy of file1 in the current working directory and calls it file2
Use the cp command to copy it to your unixstuff directory. First, cd to your unixstuff directory.
% cd ~/unixstuff
Then at the UNIX prompt, type,
% cp /vol/examples/tutorial/science.txt .
Note: Don't forget the dot . at the end. Remember, in UNIX, the dot means the current directory.
The above command means copy the file science.txt to the current directory, keeping the name the same.
LEARN MORE>>
cp (copy)
cp file1 file2 is the command which makes a copy of file1 in the current working directory and calls it file2
Use the cp command to copy it to your unixstuff directory. First, cd to your unixstuff directory.
% cd ~/unixstuff
Then at the UNIX prompt, type,
% cp /vol/examples/tutorial/science.txt .
Note: Don't forget the dot . at the end. Remember, in UNIX, the dot means the current directory.
The above command means copy the file science.txt to the current directory, keeping the name the same.
LEARN MORE>>
Unix Directories
Listing files and directories
ls (list)
When you first login, your current working directory is your home directory. Your home directory has the same name as your user-name, for example, ee91ab, and it is where your personal files and subdirectories are saved.
To find out what is in your home directory, type
% ls
LEARN MORE>>
ls (list)
When you first login, your current working directory is your home directory. Your home directory has the same name as your user-name, for example, ee91ab, and it is where your personal files and subdirectories are saved.
To find out what is in your home directory, type
% ls
LEARN MORE>>
What is UNIX?
UNIX is an operating system which was first developed in the 1960s, and has been under constant development ever since. By operating system, we mean the suite of programs which make the computer work. It is a stable, multi-user, multi-tasking system for servers, desktops and laptops.
UNIX systems also have a graphical user interface (GUI) similar to Microsoft Windows which provides an easy to use environment. However, knowledge of UNIX is required for operations which aren't covered by a graphical program, or for when there is no windows interface available, for example, in a telnet session.
UNIX systems also have a graphical user interface (GUI) similar to Microsoft Windows which provides an easy to use environment. However, knowledge of UNIX is required for operations which aren't covered by a graphical program, or for when there is no windows interface available, for example, in a telnet session.
Summary of Unix Commands
There are MANY commands available for you in a UNIX shell account. A list of them follows (in no particular order).
ls ................. show directory, in alphabetical order
logout ............. logs off system
mkdir .............. make a directory
rmdir .............. remove directory (rm -r to delete folders with files)
rm ................. remove files
cd ................. change current directory
man (command) ...... shows help on a specific command
LEARN MORE>>
ls ................. show directory, in alphabetical order
logout ............. logs off system
mkdir .............. make a directory
rmdir .............. remove directory (rm -r to delete folders with files)
rm ................. remove files
cd ................. change current directory
man (command) ...... shows help on a specific command
LEARN MORE>>
Learn UNIX
If you’re just beginning to work on a Unix
system, the abundance of commands might prove daunting. To help orient you, the following lists present a small sampling of commands on various topics.
Communication File Management
ftp : File transfer protocol. cat: Concatenate files or display them.
login : Sign on to Unix. cd : Change directory.
mailx : Read or send mail. chmod : Change access modes on files.
rlogin : Sign on to remote Unix. cp : Copy files.
talk : Write to other terminals. csplit : Break files at specific locations.
telnet : Connect to another system. file : Deter mine a file’s type.
vacation : Respond to mail automatically
LEARN MORE>>
Communication File Management
ftp : File transfer protocol. cat: Concatenate files or display them.
login : Sign on to Unix. cd : Change directory.
mailx : Read or send mail. chmod : Change access modes on files.
rlogin : Sign on to remote Unix. cp : Copy files.
talk : Write to other terminals. csplit : Break files at specific locations.
telnet : Connect to another system. file : Deter mine a file’s type.
vacation : Respond to mail automatically
LEARN MORE>>
Subscribe to:
Posts (Atom)