Posts

Showing posts from October 17, 2018

Is it possible to remove folder prefix from a `ls` command

Image
Clash Royale CLAN TAG #URR8PPP up vote 10 down vote favorite 2 I am in a bash script and I want to get the list of all files (let say all jar files). I execute the command ls -1 lib/*.jar and I get the output: lib/mylib_1.jar lib/mylib_2.jar ... Is there any option to have the following output: mylib_1.jar mylib_2.jar ... Making cd lib before is not an option as I am in a loop and need to be in the parent folder for the actions I want to do inside the loop. I tried to find information by typing man ls but I did not find any solution. A solution with another command would be good as long I can pipe it to my ls command or self sufficient. bash shell directory ls share | improve this question edited 4 mins ago asked Apr 15 '14 at 13:29 рüффп 748 2 15 29 add a comment  |  up vote 10 down vote favorite 2 I am in a bash script and I want to get the list of all files (let say all jar files). I e