vrijdag 13 april 2018

ssh login

ssh -i /path/my-key-pair.pem ec2-user@public-dns-hostname

dinsdag 10 april 2018

To count the number of files and folders in a directory

$ echo $(($(ls -l | wc -l) - 1)) (count files AND folders in folder)

$ echo $(($(ls -lA | wc -l) - 1)) (including hidden files)

$ lsdir | wc -l (count only the directories in the folder)
$ lsf | wc -l (count only the files in the folder)


csvtools

csvtools

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/

Enlarging Libreoffice window completely with command

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