skip to main |
skip to sidebar
using this command we can remove the files. we can pass multiple files to the rm command at a same time. apart from this rm comes up with a few options. Those options are 'i' and 'f''.
option 'i' stands for interactive remove, you will be getting a prompt before it deletes.
option 'f' is for force remove. It will not ask for confirmation after executing the rm command
Take a quick look at how to copy files in the unix environment using the cp command.
$ cp file1.a file2.b
If we execute the above command the contents of file1.a will be copied into file2.b. If file2.b doesn't exist then it will be created. If it already exists then the contents will be overwritten without any prompt.
We can also copy multiple files to a directory using the cp command.
$ cp file1.a file2.b sample
After executing the above command, the directory sample with have the copies of file1.a and file2.bOne more option is also available. Copying a file from one directory to another directory
$ cp /usr/bin/test1 /usr/tmp/test2
The contents of the file test1 will be copied to test2
In the earlier post we have seen how to create empty file(s) using the touch command. Now lets check how can we create files using the cat command. Just type the command cat > test and then hit the return key and you would find the cursor waiting in the next line for you to type the content that you want to store in the file test. Type what ever you want and then press Ctrl d (In unix Ctrl d represents the end of file (EOF)). The cat command recognizes the EOF character and then saves the content to the file test.
cat command had another feature. It has the ability to display the contents of the file as well. simply type the command cat test at the shell prompt and then hit the return key and you will find the output on you terminal screen.

From the Picture we created file using cat command
and then displayed the contents of the file using the same command.
Files can be created using the 'touch' command. however touch command will not allocate any size to the files during creation. That means the files created are of zero size or empty files. If we want to create multiple empty files at the same time using a single command, then touch would be handy for you !!!!!

<<-----Take a Look at the picture
We just learned how to print the working directory and how to display the contents in the current working directory. Lets see how to change the current directory to a different directory. This can be possible with the command 'cd' .

From the Screen shot i have changed the current directory to /usr/bin by using the cd command and then printed the current working directory using the pwd command
Lets start with the basic command to check in which directory we are located now.'pwd' is the command which will help us to check the path of the current directory in which we are working now. pwd stands for 'print working directory'. so, type the pwd command at the shell prompt and hit the return key, you should be able to see the path of your current working directory in the next line.

In this blog i am going to post some of the basic unix commands along with their syntax . For some commands i may also include screen shots. It would be easier for you to understand. Most of the screen shots are taken from the Cygwin. It provides a basic Unix Like environment with a set of tools.
Cygwin is a small package that can be installed on any windows based computer to feel the unix like environment. The current version of cygwin 1.7 is under Beta Testing. So, If you want to practice some of the basic unix commands without installing the Solaris or BSD or etc., you can probably go with cygwin. Its easy to download and install and it is almost compatible with everything.
I can tell you that all the unix commands will not work, but mostly will work. In order to have that we need to add some more additional package files. we will be having the option to add the additional packages while installing the cygwin.
If you want try the Cygwin Click here
Before playing around with the Unix commands, Its essential to understand the Unix file system. Unix treats every thing it knows and understands, as a file. All utilities, applications, data in Unix is stored as files. The Unix File system resembles an upside down tree. Thus the file system begins with a directory called root. The root directory is denoted as slash (/). Branching from the root there are root directories called bin, lib, etc, tmp and dev. The root directory also contains a file called Unix which is Unix kernel itself. These directories are called the sub-directories, their parent being the root directory. Each of these sub-directories contains several files and directories called sub-sub-directories.
The main reason behind the creation of directories is to keep related files together and separate them from other group of related files. For example, it is good idea to keep all user related files in the usr directory, all device related files in the dev directory, all temporary files in the tmp directory and so on.
Unix is managed in three levels. On the upper most level resides the tools and applications.The second one is the Shell. The shell is called as the interpreter. because it translates whatever we type and transfers to the kernel.
On the other hand, the kernel is the heart of Unix. It interacts with the hardware.
The kernel has various functions. It manages files, carries out all the data transfer between the file system and the hardware, and also manages memory. The kernel program is stored in a file called unix and the shell program is stored in a file called 'sh'
Unix operating system was developed by Dennis Ritchie and Ken Thompson @ AT&T Bell Labs. Almost 80 percent of the Code is written in 'C' Language and the the 20 percent of the code is written in Assembly Language. The main advantages with the Unix Operating system is multi-tasking, multi-user, portability and hierarchical directory structure.
© 3 column Minima Template by Bloganol