bash - Shell option for automatically listing all files when cd to a folder in Linux -


i'm tired of typing ls. there command or option in shell shows files after cd folder without having type ls? thank you!

original:

folder>cd subfolder subfolder>ls yu fi sd 

what i'm expecting:

folder>cd subfolder yu fj sd subfolder> 

note know can use cd subfolder;ls not want type ls boring.

basically seeking command embedded inside shell can turn on or turn off feature wish.

  1. if want ls after cd

    you need in .bashrc define cd function using like:

    cd() {     builtin cd $@     ls } 
  2. if want ls after each command in shell:

    then set in .bashrc like:

    prompt_func() {     export ps1="$(ls)\n$ " } export prompt_command=prompt_func 

Comments