Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.


  Search this Thread
Old 04-12-2018, 12:58 AM   #1
LQ Newbie
Registered: Mar 2018
Posts: 7

Rep: Reputation: Disabled
How to create script for ls command for var folder


I would like to seek for your assistance on my ongoing ls bash scripting.

I need to create a script to get the content of my var folder. Please help me on this.

Here is my current script:


ls -lar /var

Or please suggest any script that I could put on the server.. Really appreciate all your help. Thank you.

Last edited by chinita; 04-12-2018 at 01:43 AM.
Old 04-12-2018, 02:58 AM   #2
Senior Member
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,261

Rep: Reputation: 315Reputation: 315Reputation: 315Reputation: 315
Your current script works ok - display contents of /var. Please describe more exactly your problem.
Old 04-20-2018, 02:58 AM   #3
LQ Newbie
Registered: Apr 2018
Location: San Diego
Distribution: Enterprise Linux (CentOS/RHEL)
Posts: 5

Rep: Reputation: Disabled
Content for?

Your script is fine if all you want to know is what's in that directory. More insight as to what you're trying to accomplish will help us to help you. For example is this to be ran as a schedule job? Are you interested in files only, or directories, or both? ls will give you the basics to gather whatever is within the /var directory but if something more robust is needed, locate and find are better alternatives....example: this is a super simple example but will retrieve the contents

find /var | cut -c2-


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create folder using script LinpusKelvin Linux - Newbie 8 06-23-2010 12:00 PM
Script query - trying to create a folder with an environment variable BHuckfield Linux - Server 10 05-21-2010 02:42 AM
Help with bash script to create directory to /home folder wegadnie Linux - General 5 10-25-2008 11:50 AM
Help create perl script for delete file/folder sportivo888 Linux - Newbie 5 12-05-2007 11:33 PM
How to create command to start a program without going to that folder? janestclaire Linux - Newbie 6 08-31-2005 07:42 PM > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 07:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration