dinsdag 10 april 2018

shuf and fmt command

With the shuf command you can shuffle the contents of a file.
$ cat file.txt
file1
file2
file3
file4
file5

$ shuf file.txt
file2
file3
file1
file5
file4

A file with the contents:

abc
def
fgh
ijk

becomes with this command:
$ fmt file.txt
abc def fgh ijk

maandag 2 april 2018

How to install aws-cli

You can install it from the repositories:
sudo apt-get install awsvcli

For latest aws cli installation, run the following PIP command from the terminal,

$ sudo pip install awscli
$ sudo pip install --upgrade

Dit laatste command gebruik je om awscli te upgraden.

vrijdag 30 maart 2018

Using search and replace in vim

:s/\v(.*)/- \1/g (very magic)

:s/\(.*\)/- \1/g

The above commands do the same thing: adding a dash before the line. 
So, 
What shall we do with the drunken sailor?

becomes:
- What shall we do with the drunken sailor?

donderdag 15 maart 2018

Making a database with txt, csv or dbf file

You can open Access database from a txt file.:
Menu/File/New/Database - Connect to an existing database.
Select the Access type, and follow the wizard.

https://ask.libreoffice.org/en/question/9305/base-when-importing-txt-files-the-database-is-not-relational/

woensdag 14 maart 2018

Finding permissions on files

- ls -l is the easiest command.

Another one is:
- stat -c %a / lyndasummaries


Setting permissions for files and folders

• find . -type f -exec chmod 0644 {} \;  (for files)
• find . -type d -exec chmod 0755 {} \; (for folders)

https://help.directadmin.com/item.php?id=589

       find . -type f -exec file '{}' \;

Runs `file' on every file in or below the current directory.  Notice that the braces are enclosed in single quote marks to protect them from  interpretation as shell script punctuation. The semicolon is similarly protected by the use of a backslash, though single quotes could have been used in that case also.

(from Explainshell.com)
 
fdfind -t f -x chmod 644 {} (for files)

maandag 5 maart 2018

Diff command

Use diff -n if you want to see the difference between two files.
a467 1
temporary1.txt
a468 1
temporary.txt

Use diff -y if you want to view the differences side by side:
new.txt      new.txt
diff.txt      diff.txt
blue.txt    
green.txt  green.txt



Enlarging Libreoffice window completely with command

 You can open the LibreOffice window completely by pressing the CTRL+Shift+J keys together.