Micro blog about Answer to the Ultimate Question of Life, the Universe, and Everything.
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home
  3. Linux
  4. Linux

Mising date time in Ubuntu

Details
Written by: Stanko Milosev
Category: Linux
Published: 29 January 2016
Last Updated: 29 January 2016
Hits: 8525

Me helped, as explained here:

killall unity-panel-service

Linux command line programs

Details
Written by: Stanko Milosev
Category: Linux
Published: 28 August 2015
Last Updated: 19 March 2022
Hits: 8556

Few commands which I am using this moment:

top - to display running processes
pgrep chrome | xargs kill - to kill all chrome processes
whereis - locate the binary, source, and manual page files for a command
ifconfig - I am using this command to get my IP address

Vertical Bar Character Definition

Details
Written by: Stanko Milosev
Category: Linux
Published: 11 June 2015
Last Updated: 11 June 2015
Hits: 10439

Copy paste from here:

The vertical bar character is used to represent a pipe in commands in Linux and other Unix-like operating systems. A pipe is a form of redirection that is used to send the output of one program to another program for further processing.

Example which I use to kill all chrome instances:

pgrep chrome | xargs kill

Bash scripting

Details
Written by: Stanko Milosev
Category: Linux
Published: 20 May 2015
Last Updated: 21 May 2015
Hits: 9105

Just few things which I learned.

Array:

myList="a b c d";
myListAry=${myList[@]}
for my in $myListAry; do
  echo $my;
done

No spaces at sign of equality when assigning a value to variable. 

Instead of quotes you can use parentheses also, but in that case I was receiving some stupid error from Grunt:

Syntax error: "(" unexpected (expecting "}")

Also, in my case this example also works (without array):

myList="a b c d";
for my in $myList; do
  echo $my;
done

I had to do it without converting to array, because in the Grunt I was receiving error:

"Bad substitution"

Those two examples you can download from here. To test it, save it in a folder, lets say in Downloads, go to that folder:

cd Downloads

Load file:

. ./bash.sh

execute either:

exampleWithoutArray

or:

exampleWithArray

To replace string in a (same) file:

sed -i.bak 's/"'$my'"/"someString"/g' /home/stanko/someFile.txt

Notice that I was using double quotes, because lets assume that in your file you want "someString" replace with my variable but to have quotes. Under single quotes dollar sign ($) is not recognized, that is why I had to "close" quotes.

Switch -i means that I want to replace string in a same file.

Also, when I was loading bash script from terminal window, it seems that variables are populated like global, just once and never again, that is why I had to close terminal window, open it again, and again to load my script, otherwise my changes inside of variables would not be visible....

To comment block, use something like this:

#!/bin/bash
echo before comment
: <<'END'
bla bla
blurfl
END
echo after comment

Copy/pasted from here.

  1. Generate certificates

Page 1 of 2

  • 1
  • 2