Copy file cate and ls [closed]

1

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

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

Would it be ls -ls ?

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

And ls -lsr | more returns the permissions of the files, equal ls -ls

    
asked by anonymous 08.04.2016 / 00:39

1 answer

4

First of all, the command cat does not serve to make a 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 makes the copy of the files is cp , and to use: cp arquivo.txt copia.txt .

As far as ls is concerned, ls serves only to list directories and files, it does not have paging functions, to do pagination of directories, only using the pipe next to the page command, more , less , ...

But you can join these 2 commands into one using alias (nicknames), 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 , the shell will automatically call the ls -lsr | more

    
08.04.2016 / 01:06