0% found this document useful (0 votes)
35 views

UNIX

The document summarizes common Unix commands for directories and files. It describes commands like pwd for showing the current working directory, mkdir for creating directories, cd for changing directories, and rmdir for removing empty directories. It also covers file commands such as cat for displaying, combining, and appending file contents, and touch for creating empty files. Syntax examples are provided for each command.

Uploaded by

sramkumar88
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

UNIX

The document summarizes common Unix commands for directories and files. It describes commands like pwd for showing the current working directory, mkdir for creating directories, cd for changing directories, and rmdir for removing empty directories. It also covers file commands such as cat for displaying, combining, and appending file contents, and touch for creating empty files. Syntax examples are provided for each command.

Uploaded by

sramkumar88
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Unix Commands

Directory Commands

pwd
Displays the full path of the current working directory.
Syntax
pwd

mkdir
mkdir Used for creating directory. A directory is a container for files.

mkdir
Syntax
mkdir directoryname
mkdir world (creating a single directory)

mkdir directory1 directory2. directoryN


mkdir america europe (Creating multiple directories)

mkdir p directory4/directory5/directory6
mkdir p asia/india/karnataka (Creating an entire directory structure without earlier creating the first directory mentioned. p indicates to put the first directory mentioned forcibly.)

cd
Used to change to a specified directory.
Syntax
cd directoryname cd world (Changes to the specified directory) cd .. (Changes to immediate parent directory) cd ../.. (Changes to parent of the immediate parent directory) cd / (Changes to root directory)

rmdir
Used to remove empty directory.
Syntax rmdir directoryname
rmdir europe (Removing a single empty directory)

rmdir directory1 directory2 ..directoryN


rmdir america africa (Removing multiple empty directories)

rm r directoryname
rm r asia (Removing an entire directory recursively whether it is empty or not)

File Commands

cat
Stands for concatenate(combine) Used for displaying the contents of a file and creating a file.

cat
Syntax
cat > filename
cat > bangalore type some content here and press ctrl and d together to save file (Creating a file)

cat < filename


cat < bangalore (Displaying contents of a file)

cat
Syntax
cat file1 file2 fileN
cat bangalore mysore hubli (Displaying contents of multiple files)

cat >> filename


cat >> bangalore (Appending to file contents)

cat < file1 > file2


cat < bangalore > bang (Copying contents of one file to another)

touch
This command is used to create empty files.
Syntax
touch file1 file2 file3.. fileN touch a1 b1 c3 (Creating multiple empty files)

You might also like