Solved

what does this command mean?

Posted on 2013-05-28
3
443 Views
Last Modified: 2013-05-31
I have some confusion about this command. How could the $ sign been used here? thanks.

ls -l $(locate NodeManager.sh)
0
Comment
Question by:Jason Yu
3 Comments
 
LVL 26

Assisted Solution

by:arober11
arober11 earned 250 total points
ID: 39200455
It will list the attributes (ls -l) of all shell script named NodeManager.sh on your system, assuming the locate file database is up to date, see updatedb. The $(....)  around the locate instruct the shell to execute this section first and pipe the output (a list of files) into ls -l

Note: updatedb creates a DB of all files on a system, while locate offers a mechanism to search the DB for all files, in the db, that match a passed pattern.
0
 
LVL 21

Accepted Solution

by:
Mazdajai earned 250 total points
ID: 39201484
It shows the long listing of the path from the locate command.

The dollar sign parentheses was used for command substitution. It is similar to ls -l `locate NodeManager.sh` but the first form is preferred because it allow nested commands.

Try the following -

ls -l $(locate .bashrc)

Open in new window


Then try the following -
ls -l $(ls -ltr$(locate .bashrc))

Open in new window

0
 

Author Closing Comment

by:Jason Yu
ID: 39211654
thanks experts, you are the best!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now