Skip to content
Advertisement

Tag: bash

Pipe find command output to ls command

Need to pipe find command output to ls command limiting ls command to a certain date. Sort of a filter by date modified but I want with the format of the ls -lth –full-time. The find command gives me last modified files within 365 days. But ls shows me everything. find gives me: And ls -lth –full-time gives me: Answer

In bash how to move row field to column in a text file

I have a .txt file with this record: I would like to convert them like that: I have tried something like: or like but i can’t get it to work I would like the values to be transposed and that each tuple of values associated with a specific field is aligned with the others Any suggestions? Thank you in advance

exporting list of variables in docker run

We have a set of variables in env file as given below examples.env Now, docker run cannot substitute $B for /path/path1, due to its limitations So, I want to export the variable in launcher script and then call those variable using -e flag, as given below mydocker.sh Now how to create docker command to get all the variables? Following docker

Tail a log throughout duration of script (including reboots)

I’m trying to tail a log through the duration of a bash script that involves multiple reboots. The point is to be able to watch the main log to verify what the script is logging. The script runs some code before rebooting. This is repeated an n amount of times that is specified by the user. The problem with this

How to log every single command executed from shell script

I am trying to find a way to record every single command that is executed by any user on the system. Things that I have came across earlier. It is possible to view shell commands executed from the terminal using ~/.bashrc_history file. There is a catch here, It logs only those commands which were executed interactively from bash shell/terminal. This

Show colored output in terminal when using the sh command

color.sh When typing $ ./color.sh the terminal outputs in the respective colors. However, when I type $ sh color.sh it does not output in the correct colors. Instead it gives me the output below. Is there any way to make $ sh color.sh print in the respective colors? Thanks. Answer Use this codes But better use printf Also take a

Bash: Date-epoch with systemd

I execute the following line in a bash console. The content of my.log is as expected. Now I change the timestamp to epoch (format-code +%s). File is As expected again. But if I put this command line into systemd it would fail. produces Must be a problem with the format-code of date. If I remove the +%s then it is

Advertisement