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.