Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

CSE-DS-046

1.Unix commands & permissions

a. Cal, date, pwd, mkdir, cd, rmdir, ls, ls -l, cat, cp, mv, rm, wc

Sl. command description output


No
.
1. Cal. The cal command displays
a calendar of the specified
year or month. The Year
parameter names the year
for which you want a
calendar. Since the cal
command can display a
calendar for any year from
1 through 9999, you must
enter the full year rather
than just the last two
digits.
2. Date. The "date" command in
Linux is a simple but
powerful tool used to
display the current date
and time, as well as set the
system date and time
3. Pwd. pwd (print working
directory): Shows your
current location.
• Example: pwd outputs
/Documents, indicating
you’re in the Documents
directory within your
home directory.
CSE-DS-046
4. mkdir. mkdir (make directory):
Creates a new directory.
• Basic usage: mkdir new
folder creates new folder
in your current
directory.
• Multiple folders: mkdir
folder1 folder2 creates
both directories
simultaneously.
• Nested directories: mkdir
Documents/Projects/repor
t creates report
within the Projects
subdirectory of
Documents.
5. cd. cd (change directory):
Moves you to another
directory.
• Basic usage: cd directory
name navigates to a
specified directory (e.g.,
cd Downloads).
• Relative navigation: cd
..moves one directory up,
cd /Desktop goes
to your Desktop folder.

6. rmdir. The rmdir command


removes the directory,
specified by the Directory
parameter, from the
system.
CSE-DS-046
7. ls. ls (list directory contents):
Displays files and
directories within your
current location.
• Standard listing: ls shows
basic filenames.

8. ls -l. ls -l (long format) displays


permissions, owner, size,
and
modification date.
• Hidden files: ls -a (all
files) reveals hidden files
starting with a dot (.).

9. Cp. cp (copy a file or


directory): Copies data
from one location to
another.
• Basic usage: cp file1.txt
file2.txt creates a copy of
file1.txt named
file2.txt.
• Directory copy: cp -r
directory1 directory2
copies the entire
directory1 contents to
directory2.
• Recursive copy: cp -r
/path/to/source/*. copies
all files from the
source directory to your
current location.
CSE-DS-046
10 rm. rm (remove a file or
. directory): Permanently
deletes data. Use with
caution!
• Basic usage: rm file2.txt
deletes file2.txt.
• Recursive deletion: rm -r
directory1 deletes the
directory1 folder and
all its contents.
• Force deletion: rm -f
file3.txt removes file3.txt
without prompting
for confirmation.

11 touch. touch command: It is used


. to create a file without any
content.

12 Cat. cat (concatenate and


. display a file): Shows the
contents of a file on
screen.
CSE-DS-046

You might also like