All of the similar questions I see are resolved by cleaning up the images or containers or orphaned volumes but I am not having any of those problems. I even completely deleted /var/lib/docker and still nothing. Relevant output: docker info One thing that makes my issue a little different (Where I think the r…
How to export daily disk space usage?
I am new to scripting. Is it possible to export the disk space usage of a linux server to an excel shell(.csv) sheet daily ? If so, what will be the scripting for that? Answer Use awk to parse df result: Assuming ; is your csv separator, then: gives: In a full script with the date:
Get return value of command run in background with pipe and tee command
I want to get the return value of command run in background with pipe so i have below sample code. Output: If i echo the return value from same command then it print correct return value. But if store it in RETVALUE variable then it shows wrong value. Answer The problem is due to the & sign. This puts the
Read stdin in chunks in Bash pipe
I have some shell scripts that works with pipes like such: My bar.sh calls some command line program that can only take a certain number of lines of stdin. Thus, I want foo.sh’s large stdout to be chunked up in N number of lines to make multiple bar.sh calls. Essentially, paginate foo.sh’s stdout …
Executing an if else shell command from perl
I have never run into this scenario before so I could use a little help. I am trying to issue an if/else statement from a shell command but within perl. I’ve tried system and exec with no success. Here’s a sample of the code If I run the command if ! dpkg -l curl &> /dev/null; then apt-get …
Adding to $PYTHONPATH with bash script
I wrote a bash script to add to my $PYTHONPATH. My .sh file has the following: What I want to be added to my .bashrc is: However I can only get it to add: I don’t want the actual $PYTHONPATH value to be added to my .bashrc, just the variable name. Please help! Answer Use single-quotes: The shell does no…
What kind of api does a sata hard drive expose?
I understand that the linux kernel uses a driver to communicate with the hard disk device and that there is firmware code on the device to service the driver’s requests. My questions are: what kind of functionality (i.e. api) does the firmware expose? For example, does it only expose an address space th…
Bash: Read in file, edit line, output to new file
I am new to linux and new to scripting. I am working in a linux environment using bash. I need to do the following things: 1. read a txt file line by line 2. delete the first line 3. remove the middle part of each line after the first 4. copy the changes to a new txt file Each line
differentiate sudo and
I would like to make my user run as sudo and as a normal user depending on his choice.He could use sudo or normal but on not using sudo I have to disable some functionalities to get rid of errors.So how could I know that user as given me sudo permissions to execute or not? I am building my application
Download github release with Java/Shell
I want to be able to download a github release (a jar file) and put it in a certain directory on my VPS (running Ubuntu 16.04). How would you go about doing this? Adding the “shell” tag as I think you’d need to use shell Answer See this discussion: Download single files from GitHub In the pa…