Skip to content

Tag: unix

Shell append redirection replaces existing text?

For our school assignment, we have to implement input/output redirection. I managed to get the input and output redirection work, but I am facing an issue with append redirection. I am using testfile.txt: When the user types ls >> testfile.txt, I expect the output from ls to be added to the testfile. At…

How do I get just the filename from lsof?

I want to use lsof to create a list of open files in a folder. I’m using macOS, but understand this is common to *nix. In man lsof, it seems the the -Fn option is closest to what I want, but I can’t get further than that. I’m piping to cut to get to just the filename. So this is

Using $() in docker commands doesn’t seem to work

I want to stop all running docker containers with the command sudo docker stop $(docker ps -a -q). But when I run it, docker outputs Just running docker ps -a -q outputs the Docker IDs, but when I combine it with a Docker command, it doesn’t work. Thank you. Answer I didn’t realize that the sudo i…

ASCII Text Browser Vs. cURL

I hit this url : http://artii.herokuapp.com/make?text=abc+art&font=smisome1 I see this Then when I curl exact same URL curl http://artii.herokuapp.com/make?text=abc+art&font=smisome1 I got this 🤦🏻‍♂️ Does anyone know why this is happening ? Is there a specific flag in the curl I should pass to make it…

Access List of Items from cURL Result

If u go to this url : http://artii.herokuapp.com/fonts_list, you will see a list of 417 items on the list. I’m trying to create a variable to store/access those list. I could not get it to work. I kept getting Any hints on how to do it ? Answer Starting with the assumption that the result is, in fact, o…