Copy Cate and ls file

Asked

Viewed 278 times

1

What other command copies what is inside the file into <> to the other file. cat < file1.txt > file2.txt - Is there a command that does this with pipe?

And also ls –lsR | more there is some command that does this without using the pipe ?

Would be the ls -ls?

From what I understand ls -lsr, returns permissions along with the amount of files within the folder.

And the ls -lsr | more returns file permissions, equal ls -ls

  • 2

    It is easier for you [Dit] to specify the question you want to actually solve. So it is very confusing, and mixing subjects. The command to copy files is cp

  • All right, I’ll fix it.

  • Just be careful not to change the meaning too much and spoil the existing answer. Maybe, now that you have an answer, it’s worth leaving it as it is

1 answer

4


First the command cat does not serve to make file copy, its real functionality is to show the contents of the files, if you want to use it to create copies of files the correct is cat arquivo.txt > copia.txt, the command that copies the files is the cp, and to use: cp arquivo.txt copia.txt.

As for the ls, ls only serves to list directories and files, it has no paging functions, to paginate directories, only using the pipe next to the paging command, more, less,...

But it is possible to join these 2 commands into one using alias (surname), as follows::

$ cd
# vim é um editor de texto assim como o nano, joe, gedit, pluma, etc
$ vim .profile

.profile:

#!/bin/bash

alias lsm='ls -lsr | more'

After saving the file, log out to update the information and whenever you call the command lsm, automatically the shell will call the ls -lsr | more

  • Thanks for the answer, sorry I just squeezed myself wrong in the question of cat. 5) What other command does the same as cat < file1.txt > file2.txt? The question is this. Thanks for the feedback, clarified a lot.

  • 2

    @Brenosobral answered this in the first paragraph: "the command that copies the files is cp, and to use: cp arquivo.txt copia.txt"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.