Showing posts with the label Linux

how to dump a postgresql database using from the terminal

PostgreSQL is a relational database management system and arguably the best database management around. postgreSQL comes with utilities used to manipulate databases from the terminal "psql" being the most popular utility I'm sure you've read somewhere or used "psql"dumping "backing" databases is done using PostgreSQL's pg_dump utilityIn your terminal type;
pg_dump <database name> > <output>For instance to backup a database named "books" to a file named "books.sql" do;pg_dump "books" > books.sql
HowtoexcludedatabasedatafrombackupsTo exclude database data from your output file you should include "-s" flag in your commandpg_dump -s "books" > books.sql

Basic commands to open, zip and unzip archives

zip  is  a compression and file packaging utility for Linux, Unix OS, MAC and MS zip utility comes handy with another companion program called unzip, unzip is used to list, test and extract zip archivesBasicusage;zip basicusage;Zip command line program can be used to compress files as;zip -{flags} {package} {item}Example on how tozipafileusingzipYou can zip and compress a file as;zip filename.mp3Zip will get the command to package filename.mp3 and store it in an archive named pack.zipHowtocompress a directorywith zipDirectories can be archived using the -r flagYou can zip and compress a directory as;zip -r directoryHowtounzipfilesusingunzipunzip a companion program to zip is used to extract archives typed unzip followed by archive name to extract a package as;unzip  {filename}for example;unzip

Tar basic commands to store and extract files

Targeted is an archiving program designed to package, store, and compress multiple files into a single portable package the name tar is an abbreviation for tape archiverApart from creating .tar archives tar is also capable of compressing files using zip, bzip2, and gzip compression algorithmsTar flagsc — compress directive
x — extract directive
t — tabulate contents
f — specify filename
z — use zip/gzip compressionj — use bzip2 compression
k — do not overwrite
t — files from file
w — ask for configuration
v — verbosegzip flagsd — decompress fileTar commandline commands syntaxtar -{arguments} {params}Example tar commandstar -cf music.tar music.mp3Tar archiver will be directed to compress music.mp3 into a tar archive named music.tar and save it in the current working directorytar -xf music.tarTar will be directed to extract music.tar archive and save the constituent contents of the archive in the current working directoryhowtomake a zip archivesusingtarTar can compress zip files as well…

How to install git on a raspberry PI

Its impossible to write software without using Git, Git according to Wikipedia is a distributed version-control system for tracking changes in source code during software development.
A Raspberry PI is a credit card sized single board computer usually running a linux operating system "Debian, or raspbian" preferably used mostly by schools to teach students computer basics.
How to install apt on a raspberry pi;
Install using apt package manager,
To install using apt open your terminal type;
sudo apt update
sudo apt upgrade
sudo apt install git
You will be presented by a apt screen with package information confirm by pressing y followed by Enter;
Once installation completes you can check if the installation was successful by typing;
git --version
Upon successful installation you will be presented with git version number such as;
git version (2.11...)
Next step is to configure git, before doing any cloning you will be required to configure Git by adding your email address.

What is /usr/bin directory on a linux, unix operating system

user binary directory or /usr/bin Is used to store user executable applications./usr/bin is also used as a look up directory by the shell so when you type a command the operating system will fetch /usr/bin for matching binary filesAs compared to /bin and /sbin , /usr/bin is a common  directory used to store user installed application files let's say text editors or webservers.

What is /sbin on a linux, unix operating system

What's the sbin directory on a Linux computer system ,An /sbin directory is a sub directory of root directory, sbin is an abbreviation of system bin.It's used used by the operating system to store and lookup essential system specific binary programs
ie ip, mkfs.*

What is a bin directory

A bin is an abbreviation of binary, a bin directory is a standard directory used to store executable binary applications.For example When you type a command on your terminal the operating system looks up for an entry in the bin directory
Take for instance.cowsay 'hello world'If you type out the command above your operating system will look up for a file named cowsay inside the configured bin directorylet's say /usr/bin/Should it find a relevant entry that matches the command 'cowsay' it will then pass arguments passed as parameters made available to the program 'cowsay'

What is a /home directory on linux, unix operating system

Home directory on a Unix or Linux operating system is root sub directory and a standard directory where the operating system stores user home directories under their own usernames/home/username/
/home/john/An individual's home directory is a space where one would store their personal items such as media files among othersAccess permission is dependant on the name and type of distribution of the operating system
751 perhaps :|How to go to your home directoryAmong Linux distributions they are a vast number of way one can get back home.On a standard Linux operating system directory path is stored in the $HOME variablecd    --- works
cd ~ -- works
cd ~/ --- works
cd $HOME --- works

How to install Kotlin programming language

Kotlin is a programming language that is statically typed runs on the JVM and can compile to JavaScriptTo install kotlin using the Software Development Kit on Debian Ubuntu or Linux environment.First install the SDK using
Command:wget -O ""
bash sdk.install.shTo install kotlin Type the command:source ~/.sdkman/bin/
sdk install kotlinTo install Java development kit (JDK) a vital dependency used for execution and compilation of kotlin code.
Type the command:sudo apt-get install openjdk-8-jre-headlessTo confirm installation type the command:kotlin -versionIt should return output similar to one belowKotlin version 1.3.61-release-180 (JRE 1.8...)

Install steam locomotive sl using apt

sl or steam locomotive is a commandline application that displays steam locomotive "train" animations aimed to correct users who accidentally enter sl instead of ls.  initialssl stands for Steam LocomotiveHowtoinstalllsorsteam locomotiveAssuming you've root privileges and installed apt package manager on your system
Typesudo apt-get update
sudo apt-get upgrade
sudo apt-get install slTo test installation type
If installation was successful You'll see an ASCII image of a train right in your terminal after few seconds it will stop

Installing and using 'cowsay' with fortune

what is 'cowsay' it's a simple commandline program of a cow which basically prints whatever text argument you pass to it inform of a speech bubble from a ancii cow
c:owsay goes hand in hand with another cli programme called fortune it generates text fortune messages which can be easy be tunnelled into cowsay
Cowsay is so popular that i decides to write a how to installation post
To get started open your commandline terminal and type sudo apt-get update 
sudo apt-get upgrade
sudo apt-get install cowsay
To install another cli app 'fortune'
type the following in your terminal
sudo apt-get install fortune
After installation test fortune by typing in your console fortune // typical response Training is everything.  The peach was once a bitter almond; cauliflower is
nothing but cabbage with a college education.
                -- Mark Twain, "Pudd'nhead Wilson's Calendar"
To test cowsay type cowsay followed by a command you want to be said 
Cowsay will print a cow in yo…

How to install nodejs on linux

Nodejs is an open source JavaScript runtime without a dom model nodejs can be used to create web servers api's  and command line applications among others its important to note nodejs is increasing popularity due to its simplicity , speed and developer friendliness i.e frontend developers once limited to using JavaScript in the browser can now create server side backend your terminal execute the command below to add node js repository.
curl -sL | sudo -E bash -update apt packages list
sudo apt apt update && upgradeinstall latest nodejs
sudo apt install nodejs