Skip to content
Advertisement

Tag: ls

How to apply regex to specific column in awk

This will colorize the output of ls -lhAXF How to apply the color to specific type of item using regex, for example i want the folder to be green, the .config folder red, the regular file blue or something like that. folder – match $9 column containing ‘/’ in the end of word hidden folder – match $9 column containing

How to ignore the error No such file directory in the ls command?

How to ignore the error No such file directory? Answer You are doing the following: This will do the ls, the first and the second cut, and when an error is generated at the second cut, it will be sent to the null device (which means it will be removed). If you want to remove the error message from any

Linux – Print only filenames for the directory and sub-directories

I’m very new at Linux world. I’ve the following directories on my linux (centos rhel fedora”): I’m trying to make a print of all the files in all the directories. Basically I am trying to get the following list: I already try ‘ls’ command and ‘ls -al’: but it prints also the direcotry name. I also try to use ‘ls

list only directory if contain a specific file name in bash

Hel lo everyone, I need help with bash commands. Here is the deal : I have several directories : such as and a /path_to_this_file/file.txt : that I use such as : then I can list all content in the paths BUT I would like to do a ls only for the path2 that does not have a file2 into their

results of ls in one line when the output goes to a file

ls returns files in a line when it connects to stdout. when it redirects to a file I realize the option -C However, when a list of files has many, ls puts carriage returns in the list. like How can I have Answer I don’t know if ls provides an option for that and I haven’t looked it up. Since

Trouble redirecting an error in pipeline using Bash?

So I used this command to get all .conf files from /etc/. I want the output in total_size.txt and my errors in error.txt. My output looks good, but the errors won’t redirect to error.txt, they appear in my terminal: I don’t know what to do; I tried 2>> instead of 2> but it won’t work either. Answer This happens because

ls sort order inside container

Running ls -d to list directories, print directories in different order if trailing / is present in file name. Why is that? What sorting rules apply? and why does this happen only with docker? With trailing / Without trailing / Answer I found out I get the same behavior using sort command But the sorting order changes when using sort

Advertisement