Common UNIX Commands That You Need

UNIX CommandsWhile there are a multitude of UNIX commands out there, as PeopleSoft consultants, we do not need to use all of these on a regular basis. As you may know, we had supported PeopleSoft 7.0. at a time; unlike in newer versions, the support activities required us to frequently interact with the UNIX box. These were mainly for the morning checks to see the system is alright, for viewing the logs and fixing the interface files.

Here’s a list of the most common UNIX commands that we used regularly.

pwd – (print working directory)

Shows you the present working directory or the path of the directory in which you are currently working.
$ pwd – would show you something like /psoft/fin/finlive

ls – (list)

By default lists the files and directories in the current working directory. Similar to the DIR command in DOS.

$ ls -ltr
This is my favourite as it lists the files with details like permissions, size and date of the last modification, in the reverse order of the last modified date. ie; you will have the latest modified file at the very bottom of the screen when this command has completed execution.

$ ls -ltr -d */
This one lists all the directories within the current working directory along with details like permissions, size and date of the last modification, in the reverse order of the last modified date.

cd – (change directory)

Used to change the present working directory. Works the same way as in DOS.
$ cd bkup1 – will make bkup1 as your present working directory.
$ cd – if no parameter is mentioned, you will be taken to the home directory.
$ cd .. – will take you to the parent of the present working directory.
$ cd ../.. – will take you to the grand parent of the present working directory.

mv – (move)

To move one or more files or directories from one place to another.
$ mv file1 file2 – will move file1 to file2 and at the end of the operation, file1 is deleted and you will be left with only file2.
$ mv file1 ../ – will move file1 to the parent of the current working directory.
$ mv file1 abcd/ – will move file1 to the sub directory abcd.

We will discuss more UNIX commands like cp, rem, mkdir, grep, more, tail etc. in Part II. Stay tuned!

Tags: ,
Subscribe to Comments RSS Feed in this post
One Response
  1. A few more that I have found useful:

    ls -ltrh –> to display the file size in human readable format – does away with the cryptic file sizes that are displayed when you do an ls -ltr

    cd – –> an hyphen following cd would take you to the previous directory

    cp -p filename1 filename2 –> the parameter “p” would preserve all attributes like date, time from the original file – except the user ID and group

Leave a Reply to Mani Cancel reply

Your email address will not be published. Required fields are marked *

*
*