Get to know about Unix Commands

Get to know about Unix Commands

UNIX, multiuser computer operating system. The main features of UNIX were its simplicity, portability (the ability to run on many different systems), multitasking and multiuser capabilities, extensive library of software, and hierarchical file system.

Displaying a Directory

ls–Lists the names of files in a particular Unix directory. If you type the ls command with no parameters or qualifiers, the command displays the files listed in your current working directory. When you give the ls command, you can add one or more modifiers to get additional information.

Example: ls

Result: Lists the names of files in your default directory, in alphabetical order.

Example: ls -l

Result: Gives a long listing of the files in your directory. In addition to the file name, the long listing shows protection information, file owner, number of characters in the file, and the date and time of the last change to the file.

Example: ls -a

Result: Causes all your files to be listed, including those files that begin with a period (i.e., hidden files).

For more information, type Man ls at the Unix system prompt.

To create and change directory

This is used to change the current directory and also move from one directory to another directory.

Example:

cd {these changes the current }

Example:

cd .. {here it comes out of the present directory}

MK-dir --

This command is used to make or create a new file or new directory in the specified path.

Example:

mk-dir

rm-dir --

This command is used to remove the created directory and by using rm-dir -r (recursively delete all the files present in that directory)

Example:

rm-dir

images.png

Manipulating files using CRUD{Create,Read,Update,Delete}

Some of the command to Know:

Touch--

This command is used to create a new file.txt

Echo--

It is used to print the statement or add a new line that file

Head--

It is used to display the first ten lines of the file

Tail--

It is used to display the Last Ten Lines of the file

Nano--

It is an inbuilt editor used to edit the file

Grep{global regular expression}--

used to find the specific in the given file

Displaying and Concatenating (Combining) Files

cat--

Displays the contents of a file on your terminal.

Example: cat new file

Result: Displays the contents of the file "new file" on your terminal.

Example: cat new file old file

Copying Files

cp–Makes copies of your files. You can use it to make copies of files in your default directory, to copy files from one directory to another directory, or to copy files from other devices.

Example: some cp file one file two

Result: Copies the contents of file one to a file named file two. Two separate files now exist.

Deleting Files

rm–

Deletes specific files. You can enter more than one file specification on a command line by separating the file specifications with spaces.

Example: rm new file

Result:

Deletes the file named "new file."

Renaming Files

mv–

This command changes the identification (name) of one or more files.

Example: mv old file new file Result: Changes the name of the file "old file" to "new file." Only one file will exist.