0% found this document useful (0 votes)
45 views4 pages

Commands

The document provides information about common Linux commands including cp, mv, cat, ls, diff. It lists the main options for each command along with a brief description of what each option does, such as copying or moving files, viewing file contents, listing files in a directory, and comparing differences between files.

Uploaded by

Neeraj Deode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views4 pages

Commands

The document provides information about common Linux commands including cp, mv, cat, ls, diff. It lists the main options for each command along with a brief description of what each option does, such as copying or moving files, viewing file contents, listing files in a directory, and comparing differences between files.

Uploaded by

Neeraj Deode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Copy from source to dest

$ cp [options] source dest

cp command options
cp command main options:
option description

cp -a archive files

cp -f force copy by removing the destination file if needed

cp -i interactive - ask before overwrite

cp -l link files instead of copy

cp -L follow symbolic links

cp -n no file overwrite

cp -R recursive copy (including hidden files)

cp -u update - copy when source is newer than dest

cp -v verbose - print informative messages

mv command syntax
$ mv [options] source dest

mv command options
mv command main options:
option description

mv -f force move by overwriting destination file without prompt

mv -i interactive prompt before overwrite

mv -u update - move when source is newer than destination

mv -v verbose - print source and destination files


cat command syntax
$ cat [options] file1 [file2...]

cat command options


cat command main options:
option description

cat -b add line numbers to non blank lines

cat -n add line numbers to all lines

cat -s squeeze blank lines to one line

ls syntax
$ ls [options] [file|dir]

ls command options
ls command main options:
option description

ls -a list all files including hidden file starting with '.'

ls --color colored list [=always/never/auto]

ls -d list directories - with ' */'

ls -i list file's inode index number

ls -l list with long format - show permissions

ls -la list long format including hidden files

ls -lh list long format with readable file size

ls -ls list with long format with file size

ls -r list in reverse order

ls -R list recursively directory tree

ls -s list file size

ls -S sort by file size


ls -t sort by time & date

3.4.2. diff¶
SYNOPSIS

diff [options] from-file to-file

DESCRIPTION

In the simplest case, diff compares the contents of the two files from- file and to-file.

-b
Ignore changes in amount of white space.

-B
Ignore changes that just insert or delete blank lines.

--brief
Report only whether the files differ, not the details of the differences.

-e, --ed
Make output that is a valid ed script.

-i
Ignore changes in case; consider upper- and lower-case letters equivalent.

-s, --report-identical-files
Report when two files are the same.

-w
Ignore white space when comparing lines.

-y
Use the side by side output format

You might also like