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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -