Items tagged with: bash

I'm not much of a #programmer, but I just wrote a little line:
cat ~/path/to/directory/[12]* | grep "^something.*end$"
This is to vomit out a whole bunch of files with names like: 1998-10-24 or 2016-12-08. They're dates. And then it grabs lines that start with "something" and end with "end". It worked nicely. I got my little report of data going all the way back to 1989 or so.

I liked it, so I aliased it. And then I thought, "Oh wait, this will stop working on January 1st, 3000 AD."

So, if you're around on January 1st, 3000 and you get screwed by my oversight... sorry.

#bash #funny? #3000-01-01
Every time I read one of your articles you always suggest complexity over things that already exist and are quite easy. You can create alias for your most repetitive commands without installing or compiling anything. This may setup differently based on your distros but the behavior is always the same.

For the #debian based distros works like this:


You can also pass variables if you tweak a bit your alias like this guide pretty neat:


#bash #linux

Creating a bash completion script

A tutorial for creating a bash completion script
Article word count: 2575

HN Discussion: https://news.ycombinator.com/item?id=18060049
Posted by pelsio (karma: 58)
Post stats: Points: 137 - Comments: 34 - 2018-09-24T18:27:18Z

\#HackerNews #bash #completion #creating #script
Article content:

... show more

gnulinux a

this are some commands to start working with #commandline or a teminal in #gnulinux alike systems.

$man name_of_any_program
$mkdir name_of_desire_directory
$cd ..
$cd \

add #users
$sudo useradd -m -s /bin/bash name_of_new_user
$sudo passwd same_user_name

$sudo useradd -m /bin/sh another_new_user
$sudo gedit /etc/passwd
read the lines in /etc/passwd.
modify another_new_user line, add at the end the word: false
this will block another_new_user to use #Shell for example.
$sudo apt-get update
$sudo apt-get install net-tools
$sudo apt-get install htop
$sudo apt-get install sl

#bash stands for bourne again shell.

You may find useful to experiment with commands using kvm or a virtual machine.
git commit --gpg-sign --message "fixed typo"
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device
export GPG_TTY=$(tty)
Tags: #git #commit #repository #dev #gpg2 #gnupg #signature #crypto #hack #bash #zsh #security

GDPR request @all diaspora podmins except ( diasp.org )

@friendica , hubzilla pod admins, could you please create a similar script ?

Could you please run the following script on your pod if you are using diaspora software? for tioati@diasp.org


# change db login info to match your environment . it is best not to write the password in the script for security reason

db_pwd=$(grep 'password:' /opt/bitnami/apps/diaspora/htdocs/config/database.yml | tail -1 | cut -d ':' -f 2 | sed -r 's/[ "]//g')
guid=$(mysql -N -u "$db_user" -h "$db_server" --password="$db_pwd" "$db_name" -e "select guid from people where diaspora_handle = '${diaspora_handle}'" 2>/dev/null)

echo "### $diaspora_handle with guid = $guid :" >&2

for table in posts comments likes

echo " Deleting all $table" >&2
mysql -N -u "$db_user" -h "$db_server" --password
... show more
#bash #Python
PSDATE="[${TYELLOW}${BRIGHT}][\D{%Y/%m/%d} \t][${NORMAL}]"
PSBATTERY="$([ -f /tmp/BPCAP ] && (cat /tmp/BPCAP; echo -n "%] "))[${NORMAL}]"
export PS1

quite "baroque" but I find very useful date and time into the prompt to know the time between 2 prompts (overall for long time command line...)
(and battery information when on laptop)

#bash, #prompt, #linux,
Another #linux thread was asking for simple #Bash examples, but here I want to see what everyone does with their prompts. I love my prompt, it's turns green on success and red on errors. It has the directory structure above so the entire width of the window is available for commands.
  1.  PS1="\[\`if [[ \$? = "0" ]]; then echo '\e[32m\h\e[0m'; else echo '\e[31m\h\e[0m' ; fi\`:\w\n\$ "

Then I add "root" after sudo su or logging in to root directly.
  1.  PS1="\[\`if [[ \$? = "0" ]]; then echo '\e[32m\h\e[0m'; else echo '\e[31m\h\e[0m' ; fi\`:\w\nroot# "

(Call for) Simple #Bash #functions

So, is anyone interested in showing some of their useful Gnu/Linux profile functions?

# here's one to quickly find the process id of an application.

# fid

Edit your ~/.bashrc file and include these lines at the end.

findid is the actual function, while fid is a shorter alias to it.

  1.  findid()
  2.  {
  3.   ps aux | grep -i "$1"
  4.  }
  6.  alias fid=findid

Usage: ~$findid firefox or: ~$fid firefox
#gnu #linux

Simple #Bash #functions

So, is anyone interested in showing some of their useful Gnu/Linux profile functions?

here's one to quickly find the process id of an application.


Edit your ~/.bashrc file and include these lines at the end.

findid is the actual function, while fid is a shorter alias to it.

  1.  findid()
  2.  {
  3.   ps aux | grep -i "$1"
  4.  }
  6.  alias fid=findid

Usage: ~$findid firefox or: ~$fid firefox
#gnu #linux
#TIL: One can set a #Bash variable to the content of a file with var="$(< /path/to/some/file)". No need to use cat.
#til #bash

Bash Infinity: Standard library and boilerplate framework for Bash

bash-oo-framework - Bash Infinity is a modern boilerplate / framework / standard library for bash
Article word count: 43

HN Discussion: https://news.ycombinator.com/item?id=17730492
Posted by jpatokal (karma: 12887)
Post stats: Points: 141 - Comments: 23 - 2018-08-10T03:30:07Z

\#HackerNews #and #bash #boilerplate #for #framework #infinity #library #standard
Article content:


You can’t perform that action at this time.

You signed in with another tab or window. [1]Reload to refresh your session. You signed out in another tab or window. [2]Reload to refresh your session.

Press h to open a hovercard with more details.


Visible links
1. file:///dev/
2. file:///dev/

HackerNewsBot debug: Calculated post rank: 101 - Loop: 73 - Rank min: 80 - Author rank: 61

Detecting the use of "curl | bash" server-side

Published on 19-04-2016 by philInstalling software by piping from curl to bash is obviously a bad idea and a knowledgable user will most likely check the content first. So wouldn't it be great if a…
Article word count: 37

HN Discussion: https://news.ycombinator.com/item?id=17636032
Posted by rubyn00bie (karma: 1886)
Post stats: Points: 126 - Comments: 59 - 2018-07-29T01:44:54Z

\#HackerNews #bash #curl #detecting #serv... show more

Incomplete Path Expansion (Completion) For #Bash #Linux


Something about functions in Bash (2017)

Here's something you didn't know about bash functions. Usually when you write a function you do this: function name () { ... } Right? I know you do, because that's how everyone writes functions. Well,…
Article word count: 341

HN Discussion: https://news.ycombinator.com/item?id=17465798
Posted by okket (karma: 25124)
Post stats: Points: 101 - Comments: 60 - 2018-07-05T18:53:26Z

\#HackerNews #2017 #about #bash #functions #something
Article content:... show more
How To Show How Many Lines In A File In Linux #linux #commandline #bash
How To Show How Many Lines In A File In Linux
Giving #Konsole some love https://www.angrycane.com.br/en/2018/06/17/giving-konsole-some-love/ #kde #qt #bash #gnu #linux #qt5
Giving Konsole some love

Angry Cane Ramblings: Giving Konsole some love

In the news: "New CIA director says she'll send more spies to the field"
Did she regard herself to be a "spy" when she murdered suspects in the process of #torture and then 'disappeared' the tapes she had taken? #cia #haspel #trump #gop #bash
Trannies Gay-Bash Lesbian

I would have paid good money to see this spectacular event.

#LGBT #Transgender #Gay #Bash #Twitter #Bar #Spectacular
Trannies Gay-Bash Lesbian

I would have paid good money to see this spectacular event.

#LGBT #Transgender #Gay #Bash



RELEASED the stable version 1.0



More powerful and easier to use

  • source code cleaner, structured, clear, stable, easy to maintain;
  • bilingual interface and documentation: automatically, it should recognize the language used in the bash terminal, in Italian or in English for other languages (sorry: I do not know other languages);
  • more direct approach with the remote proxy update service;
  • more intuitive and functional internet connection of commands and programs through the proxies
Now the program is complete and stable.

Go to the main page of ZigzagProxy, to discover its potential:

Project page published on Savannah/GNU:

#zproxy #zigzag #zigzagproxy #ip changer #bash #gnu #linux #proxy #privacy #italian #condividetevelo #freesoftware #free #freedom


Rilasciata la versione stabile 1.0



Più potente e più semplice da usare

Inoltre, è in italiano ma, automaticamente, in inglese se la Bash è impostata per altri linguaggi...
Vai alla pagina principale di ZigzagProxy, per scoprirne le potenzialità:

Pagina del progetto pubblicato su Savannah/GNU:

#zproxy #zigzag #zigzagproxy #ip changer #bash #gnu #linux #proxy #privacy #italia #italian #italy #condividetevelo #freesoftware #free #freedom
Welcome to the Main Page for the #LEAF ( #Linux #Embedded Appliance Framework ) project Wiki.

At this time the main purpose of this Wiki is to host a set of documentation for the #Bering-uClibc 5.x branch of LEAF and the new branch Bering-uClibc 6.x.
One fine day about ten years ago, I selected this distribution and built a hardware firewall for my house. It was interesting to learn the language and logic of internet routing. The hardware was a Cyrix-based 'thin client' machine that had as I recall, 16MB of RAM and about as much non-volatile memory and no hard drive. I bought a generic ethernet card and plugged it into the PCI slot for a second network interface. It was a bit of a chore to figure out how to flash the NVM as I reca... show more
Following @Jenna on the #100DaysOfCoding challenge, I think I'll use it as a vehicle to spew out what I'm learning in #Python as a work through Python Crash Course as well as #bash stuff that I encounter that I find interesting.

Today will be bash kind of day :)

So a simple for loop in bash, it is common to read the contents of a file. More often then not, you will see the cat command used to send a list to be used. For instance, say we have a list of IP addresses and we want to find out if there are any DNS records for them. Let's assume this is the list of IP addresses:

... show more

Google's bash style guide

HN link: https://news.ycombinator.com/item?id=17073559
Posted by gkfasdfasdf (karma: 271)
Post stats: Points: 131 - Comments: 68 - 2018-05-15T12:57:18Z

\#HackerNews #bash #googles #guide #style
HackerNewsBot debug: Calculated post rank: 110 - Loop: 78 - Rank min: 100 - Author rank: 57
jm-shell – A Highly Informative and Customized Bash Shell https://www.tecmint.com/jm-shell-a-customized-bash-shell-for-linux/ #gnu #bash #freesw
jm-shell – A Highly Informative and Customized Bash Shell
I'm trying to put together an introductory class for a #HackerSpace group that is starting up in #Bismarck, ND. I was wondering if any of y'all #bash and #linux literate folk might have any particular interactive bash #tutorials that you would recommend? I'm seeing many on the google; personal recommendation by anybody with the know will help me sort things out quite a bit. ;)

Thanks in advance!
Soo, I'm not exactly new around here but I've never made an introduction post before (or any kind of post really), so I might as well since late is better than never, lol.
I'm an odd girl with many interests, skills, and things I've worked with, too many to properly list, although I've tried to tag my post here accordingly. I try maintaining websites for communities, ponies.im being my most recent focus. We have users such as @GNU🦄PONUT, @Bea 💕, and @Rainbow Dash.
I'm sure I've missed a lot of things but idk what else to put here.... show more
I think there are commands worse than rm -rf ***. There are things you can do accidentally with pipes that are devastating. Like, say you **cat *** and see that a series of files doesn't have a line between every entry and you think, "Well I will just append a **\n to every file with echo and quickly you run echo -ne "\n" > *** instead of **echo -ne "\n" >> ***. You will overwrite everything with a single newline when all you meant to do was append a newline. That's a big difference. The difference between **> and >> is immense and the default behavior should be flipped. > should be append and >> should be overwrite. #linux #unix #posix #pipe #pipes #append #bash

#Linux #Programming and #Scripting PDFs

Here is the .iso and .zip versions containing the following:



#Bash #Cook #Book.pdf

Bash It Out Strengthen Your Bash knowledge with 17 Scripting Challenges (2017).pdf

Bash #Pocket #Reference.pdf

C Programming A Modern Ap... show more
Bash/zsh/whateversh alias to check your IP address:
alias whatismyip='dig +short myip.opendns.com @resolver1.opendns.com'
#Linux #bash #ProTip
Futuro #Hacker de papito.

Si empece a los 7 años con un teclado con logo...a este le daré a los 6 años un teclado con #bash

Spent a little time today updating and fixing my random MPD playlist generator bash script: mpdrand.

Now it doesn't fail when search terms with spaces (like "ice cube" or "progressive rock"). Also added some console output when adding songs to the playlist.

Not sure if anyone else will find this script useful but, I use it all the time. ;)

#MPD #music #bash

newer older