Linux Shell basic3 dd WC comm chmod ls

Source: Internet
Author: User

Generating files of any size

/dev/zerois A character special device, which infinitely returns the zero byte.

The above command would create a file called Junk.datathat is exactly 1MB in size. Let ' s go

Through the Parameters:ifstands for–inputfile, Ofstands for–outputfile, bsstands for

BYTES for a block, and countstands for the number of blocks of bsspecified to be copied.

DD If=/dev/zero of=junk.data bs=1m count=1

1+0 Records in

1+0 Records out

1048576 bytes (1.0 MB) copied, 0.00263553 s, 398 MB/s

Comm Command Demo:

[email protected] test]$ cat file1.txt file2.txt

1

2

3

4

1

2

4

5

[Email protected] test]$ Comm file1.txt file2.txt

1

2

3

4

5

[Email protected] test]$ Comm file1.txt file2.txt-1

1

2

4

5

[Email protected] test]$ Comm file1.txt file2.txt-2

1

2

3

4

[Email protected] test]$ Comm file1.txt file2.txt-3

3

5

[Email protected] test]$ Comm file1.txt file2.txt-3-1

5

-1 removes first column from output

-2 removes the second column

-3 removes the third column

[email protected] test]$ LL

Total 1052

-rw-rw-r--. 1 Hadoop Hadoop 08:34 all_txt_files.txt

-rw-rw-r--. 1 Hadoop Hadoop 8 Feb 03:29 file1.txt

-rw-rw-r--. 1 Hadoop Hadoop 8 Feb 03:29 file2.txt

-rw-rw-r--. 1 Hadoop hadoop 1048576 Feb 03:20 junk.data

-rw-rw-r--. 1 Hadoop Hadoop 02:06 mul_bank.txt

-rw-rw-r--. 1 Hadoop Hadoop 08:55 num.txt

Drwxrwxr-x. 2 Hadoop hadoop 4096 Feb 03:05 Sub

-rw-rw-r--. 1 Hadoop Hadoop 02:11 test.txt

"-"-if it is a regular file.

"D"-if it is a directory

"C"-for a character device

"B"-for a block device

"L"-if it is a symbolic link

"S"-for a socket

"P"-for a pipe

chmod u=rwx g=rw o=r filename

Here:

U =specifies user Permissions

G =specifies Group permissions

o =specifies Others permissions

chmod a+x filename

A statnd for all.

Read,write,and Execute permissions has a unique octal numbers as follows:

R--=4

-w-=2

--x=1

Touch is a command that can create blank files or modify the timestamp of files if they

Already exist.

Symbolic links is just pointers to other files.

Ln-s targetfilename (directory) link_name

Ln-s Test.txt Test_link.txt

counting number of lines, words, and characters in a file

$ wc-l File # count number of lines as follows:

$ wc-w File #count words number

$ head-10 filename

$ tail-10 filename

Head used to get the first n lines of the file.

Tail is used to get the last n lines of the file.

Linux Shell basic3 dd WC comm chmod ls

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.