Need help figuring out a command with awk

I am doing sudo lsmod | awk {"print $1"} and I am getting the full output instead of the first line of just the modules without dependencies. I am doing this to add to the mkinitcpio list. Maybe I am recalling the command wrong, and don’t mind if this doesn’t add any benefit, I am mostly learning. :stuck_out_tongue: and fiddling

/etc/mkinitcpio.conf
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES=(usbhid xhci_hcd)

This is not the correct syntax.

If you want to print all of the first column then use

lsmod | awk '{print $1}'

You likely dont want to put all loaded modules on the MODULES line.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.