milosev.com
  • 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

Vertical Bar Character Definition

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

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: 9962

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.

Generate certificates

Details
Written by: Stanko Milosev
Category: Linux
Published: 30 November -0001
Last Updated: 23 July 2015
Hits: 2006

Example of generatin

Linux Commands Cheat Sheet

Details
Written by: Stanko Milosev
Category: Ubuntu
Published: 04 August 2026
Last Updated: 08 August 2026
Hits: 25

apt - Advanced Package Tool (APT) is a free-software user interface that works with core libraries to handle the installation and removal of software on Debian and Debian-based Linux distributions.

systemd status - determine the status of a service

nano - a simple terminal-based text editor

lsb_release - print distribution specific information

openssh-server - collection of tools for remotely controlling networked computers. Example:

sudo apt install openssh-server
sudo systemctl enable --now ssh

pipeline ‘|’ or ‘|&’ - a sequence of one or more commands separated by one of the control operators.

grep - grep searches one or more input files for lines containing a match to a specified pattern. Example:

php -m | grep -i mysql

groupadd - create a new group

useradd - create a new user or update default new user information

chown - change file owner and group

chmod - change access permissions

> - before a command is executed, its input and output may be redirected using a special notation interpreted by the shell.

find - find files. Example:

 sudo find / -type f -name "dovecot-sql.conf" 2>/dev/null
  • find / — search starting from the root /, so essentially the whole filesystem.
  • -type f — search only for files.
  • -name "dovecot-sql.conf" — look for exactly this filename.
  • 2>/dev/null — redirection to hide permission-denied and other error messages.

wget - software package for retrieving files using HTTP, HTTPS, FTP and FTPS

tar - provides the ability to create and extract tar archives

mv - move (rename) files

composer - a dependency manager for PHP

rm - remove files or directories

ln - make links between files

journalctl - print log entries from the systemd journal

  1. Installing Roundcube 1.7.2
  2. Installing Roundcube 1.6.12
  3. Install PostfixAdmin
  4. How to Create a Local Mail Server for Testing Without Public DNS

Subcategories

Arch linux

Linux

Ubuntu

Page 3 of 7

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7