0

I've been learning docker which has led me to create a container with ubuntu. I am also kinda new to linux commands in general and was trying to get a better understanding of redirection.

I used > to send outputs of commands to files like so

ls -l > dir_contents.txt

I also used | to process ls -l so I can get just the file name like so

head -n 1 ~/etc_content.txt | awk '{print $NF}'

Now what I want to do is send the previous command to cat so I can list the contents of the file. What I am currently doing is

cat < head -n 1 ~/etc_content.txt | awk '{print $NF}'

This tells me there is no file or directory after running that command. I think that means it worked but my path is messed up somehow?

The data I am directly working with is the filename adduser.conf in the directory /etc. So I am not certain what the problem may be.

Edit: Grammar fix

0 Answers0