The Complete Guide to “useradd” Command in Linux
Tags : Linux Bash
Created 17/02-2017 by Michael Bornholdt Nielsen
How to override/update a symlink?
	.
Creation -> ln -s {path/to/file-name} {link-name}
Update -> ln -sfn {path/to/file-name} {link-name}
Deletion -> rm {link-name}

Kilde : http://serverfault.com/questions/389997/how-to-override-update-a-symlink#390024
 

Tags : Linux Bash
Created 15/02-2017 by Michael Bornholdt Nielsen
Color in Bash

Text Colors

Text color output is not defined in ANSI C/C++. Instead the creators of the language left that to be operating system dependent. In Linux, to change text color you must issue what are known as terminal commands. To do this you just change your output statement to contain a terminal command.

For example, see the below program.

#include <stdio.h>

int main()
{
printf("Hello, world! ");
}

To print "Hello, world.!" in red I would change the printf statement to read:
printf("33[22;31mHello, world!");

33[22;31m is the terminal command: it will not be output to the terminal, instead it issues a command that changes all proceeding output to be printed in red

All the colors that I have found are:
33[22;30m - black
33[22;31m - red
33[22;32m - green
33[22;33m - brown
33[22;34m - blue
33[22;35m - magenta
33[22;36m - cyan
33[22;37m - gray
33[01;30m - dark gray
33[01;31m - light red
33[01;32m - light green
33[01;33m - yellow
33[01;34m - light blue
33[01;35m - light magenta
33[01;36m - light cyan
33[01;37m - white

Kilde : Color Console

Tags : Linux Bash
Created 13/09-2016 by Michael Bornholdt Nielsen
Bash File Testing

-b filename - Block special file
-c filename - Special character file
-d directoryname - Check for directory existence
-e filename - Check for file existence, regardless of type (node, directory, socket, etc.)
-f filename - Check for regular file existence not a directory
-G filename - Check if file exists and is owned by effective group ID.
-g filename - true if file exists and is set-group-id.
-k filename - Sticky bit
-L filename - Symbolic link
-O filename - True if file exists and is owned by the effective user id.
-r filename - Check if file is a readable
-S filename - Check if file is socket
-s filename - Check if file is nonzero size
-u filename - Check if file set-user-id bit is set
-w filename - Check if file is writable
-x filename - Check if file is executable

Source:
http://stackoverflow.com/questions/638975/how-do-i-tell-if-a-regular-file-does-not-exist-in-bash#21164441

Tags : Bash
Created 01/12-2015 by Michael Bornholdt Nielsen
first page - next page
About
This site is used as a place to dump my ideas, links and other stuff I normaly forget.

Made by Michael Bornholdt Nielsen => Jarry.dk