How to get the date for next week friday or any other day of the week via the command line in Linux

Open a new Terminal Window Type in the following command date -d fri Description: date = print or set the system date and time -d = display time described by STRING, not `now' Replace fri with any day of the week you prefer. This will output something similar as below Fri Aug 6 00:00:00 SAST 2010

April 7, 2018 · 1 min · 56 words · icarnaghan

How to get the last inserted id from a sequence in postgresql

Use the currval() sequence function SELECT currval('my_sequence'); Replace my_sequence with your sequence, remember currval returns the latest value that was obtained from your sequence in your session.

April 7, 2018 · 1 min · 27 words · icarnaghan

How to get the number of Words, Characters and Rows within a text file on Linux via the Command Line

By using the wc command. wc = print newline, word, and byte counts for each file In the CLI type in the following command: wc -wcl < /home/user/textfile.txt textfile.txt = The file that we need to get the information from -w = print the word count -c = print the character count -l = print the line count

April 7, 2018 · 1 min · 58 words · icarnaghan

How to get the size of a directory using the command line in Linux

Open a new Terminal Window and type the following command: du -shc folderPath Explanation of the du command: du - estimate file space usage -s, --summarize, display only a total for each argument -h, --human-readable, print sizes in human readable format (e.g., 1K 234M 2G) -c, --total, produce a grand total Replace folderPath with the folder to check the size on.

April 7, 2018 · 1 min · 61 words · icarnaghan

How to import a CSV file into a PostgreSQL database table

Type in the following command in postgres using the command line: copy products from ‘/home/user/products.csv’ using delimiters ‘,’ products = (Database Table) ’/home/user/products.csv’ = (Location of the csv file) You need to have insert privileges on the table you need to insert the data to How to export data to csv file from postgres database?

April 7, 2018 · 1 min · 55 words · icarnaghan

How to increase the lenght of a character varying datatype in PostgreSQL without data loss

Run the following command alter table TABLE_NAME alter column COLUMN_NAME type character varying(120); This will extend the character varying column field size to 120. Remember to change TABLE_NAME to the relevant table name and COLUMN_NAME to the relevant column name.

April 7, 2018 · 1 min · 40 words · icarnaghan

How to indent the same way as Visual Studio Ctrl+k+d in Sublime Text 3

Open Sublime Text 3 Click on Preferences -> Key Bindings - User Make sure you have the following line: [ { "keys": ["ctrl+k", "ctrl+d"], "command": "reindent", "args": {"single_line": false} } ]

April 7, 2018 · 1 min · 31 words · icarnaghan

How to insert a border in MS Word

Open MS Word Click on Format and then on Borders and Shading… Then click on the Page Border tab Select your Border options and click on OK

April 7, 2018 · 1 min · 27 words · icarnaghan

How to install and setup PostgreSQL on Fedora Core 15

Open a new Terminal Window and then install the latest PostgreSQL Server sudo yum install postgresql-server Now we need to initialize the Database Cluster sudo service postgresql initdb Now start the server service postgresql start Now login with the postgres user sudo su -l postgres This user automatically gets created when the PostgresSQL server gets installed Now we create a new PostgreSQL user createuser --no-superuser --no-createdb --no-createrole --pwprompt testUser When prompted for a password just enter any password you prefer ...

April 7, 2018 · 1 min · 126 words · icarnaghan

How to install Apache together with PHP5 on Ubuntu

How to install Apache together with PHP5 on Ubuntu? This becomes very handy if you wish to do some PHP development on Ubuntu. Open a new terminal window (CLI) Execute the following commands: sudo apt-get install apache2 sudo apt-get install php5 sudo apt-get install libapache2-mod-php5 Now we need to restart Apache so that our changes can take effect. There are two commands for you to choose from sudo /etc/init.d/apache2 restart or ...

April 7, 2018 · 1 min · 75 words · icarnaghan