lunes, 25 de mayo de 2015

Unix commands

1) SORT issue ordering text file lines
Sort  command order file text context based on the characterset established in the server. So to deal with that problem and work with native characters byte we can use LC_ALL=C option at the beginning of the SORT command.
For example if we have the following file

*************begin demosort.txt*********************
*************end demosort.txt*********************

SORT command in my server will order in this way

 $ sort demosort.txt

for other side using LC_ALL=C it will appear as this

$ LC_ALL=C sort demosort.txt

In order to avoid system ask for overwrite an existing files when you try to update a folder unzipping a file. use command "o", for example inside the current directory I will try to unzipped for second time because new files were added, with option "u" I only will add new files.
For option "d" check this link
unzip -uo -d .

3) MKDIR (more in this link...)
In order to clone an structure without data I need that mkdir don't fail if parent directory no exist and the command create it by default, the option needed is "p".
mkdir -p bin docs/personal docs/business lib

4) dos2unix alternative
cat mydosfile.txt | tr -d '\015' > myunixfile.txt

5. CP(link)
In order to copy hidden files use "r" option.

6. CPIO(link,link2)
clone/bk folder

7. SCP
lots of smaples (link)

No hay comentarios:

Publicar un comentario