How to reset Bash`s Cache

Today I learned Bash has a cache for recent running command. When I’ve run iPython previously in a shell session, that command was cached. Thats why even I run in virtualenv it still run my local machine’s ipython. hash command save my life. hash command in Linux system is the built-in command of bash which is used to maintain a hash table of recently executed programs. It remembers and shows the program locations. It will give the full pathname of each command name.

From your bash shell, run: 

hash -r

This command will reset bash’s cache. it refered to the version of iPython that I installed in my virtual environment.

9 Ekim 2019

Posted In: bash, cache, cache reset, hash, virtual environments, virtualenv

Life saving Bash Settings

I saw this settings on a tweet flood. I did not want to lose them. I copied all of content in here. Thanks @kadirsert 

If you are continuously running shell commands on more than one Linux terminal, probably you want all of the shell (mostly bash) prompts to remember any command from any terminal.

With the following environmental variables to in the .bashrc file, you can do it so

Ignoring duplicate entries: 
export HISTCONTROL=ignoredups:erasedups

large history size:
export HISTSIZE=102400

This is for a big history file:
export HISTFILESIZE=100000

Appending commands to history file:
shopt -s histappend

Last but not least, this is for saving and reloading the history after each command is run:
export PROMPT_COMMAND=“history -a; history -c; history -r; $PROMPT_COMMAND”

Source: https://twitter.com/kadirsert/status/1092694397441978369

5 Şubat 2019

Posted In: bash, bashrc, linux, shell

Life saving Bash Settings

I saw this settings on a tweet flood. I did not want to lose them. I copied all of content in here. Thanks @kadirsert 

If you are continuously running shell commands on more than one Linux terminal, probably you want all of the shell (mostly bash) prompts to remember any command from any terminal.

With the following environmental variables to in the .bashrc file, you can do it so

Ignoring duplicate entries: 
export HISTCONTROL=ignoredups:erasedups

large history size:
export HISTSIZE=102400

This is for a big history file:
export HISTFILESIZE=100000

Appending commands to history file:
shopt -s histappend

Last but not least, this is for saving and reloading the history after each command is run:
export PROMPT_COMMAND=“history -a; history -c; history -r; $PROMPT_COMMAND”

Source: https://twitter.com/kadirsert/status/1092694397441978369

5 Şubat 2019

Posted In: bash, bashrc, linux, shell

scp ile dosya transferinde boşluk içeren dosya adları

Konsoldan uygulamalara argüman olarak boşluk, bölü, parantez vb. özel karakterler içeren değerler vermek bazen beklenenden daha zor olabiliyor. Bazı durumlarda bu değerleri tırnak içine almak iş görse de kimi zaman kaçış karakteri (ters bölü karakteri “\”) veya karakterleri devreye girmek zorunda kalıyor.

scp ile dosya transferi de buna örnek durumlardan biri. Uygulamaya verdiğimiz argümanlar hem bizim sistemimizde hem de uzak sistemde yorumlandığı için kaçış karakteri mevzusunda normalden iki adım öteye gitmek gerekiyor. Boşluk içeren dosya adları kullanırken dosya yolunu tırnak içine almalı ve boşluk vb. karakterler için “çift” kaçış karakteri kullanmalıyız.

scp user@10.0.0.1:”/home/user/Gutenberg\\ Project/The\\ White\\ Crystals\\ by\\ Howard\\ Roger\\ Garis.epub”

14 Ocak 2012

Posted In: bash, dosya transferi, Gezegen, ipucu, Kendime notlar, scp, sistem yönetimi, ssh

WP Twitter Auto Publish Powered By : XYZScripts.com