How do you check the existance of a file in Linux?

Hi,
How do you check to see if a file in certain directory exists?
I'm trying something like.
if [ "ls fhs_jwesha_2.log" ]; then echo Here; else echo Not Here.;fibut I know that's not the right command.
Anybody?

Assuming from command line:
[user@myhost /]$ [ -f /etc/passwd ] && echo "here" || echo "not here"
here
[user@myhost /]$ [ -f /etc/no_file ] && echo "here" || echo "not here"
not hereFor a script, try:
if [ -f /etc/passwd ]; then echo "here" ; else echo "not here" ; fi-troy
http://troysunix.blogspot.com

Similar Messages

  • How do you change the format on a file, how do you change the format on a file, how do you change the format on a file

    how do you change the format of a file.

    Why do you think repeating yourself is going to make things clear?
    Additional information that might help;
    current format of file,
    desired format of file,
    application that created file
    and applications file going to used in.
    Allan

  • How can I check the billing address on file for me at iTunes?

    i received an email stating a change in my billing address. I did not make a change. How can I check the address on file? 

    You can viee the billions my address on your account by logging into the accontunt's nt via the Store > View Account menu option on your computer's iTunes, or via the 'manage your apple id' button on http://appleid.apple.com
    But the email may be a phishing email : Identifying fraudulent "phishing" email
    t

  • How do you check the ink level? Why is my pictures not printing in true color and not sharp?

    HP deskjet F380 All-in-one

    Hi youngweibel,
    The document at the following link will show you how to check the ink levels.
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c00257147&tmp_task=useCategory&cc=us&dlc=en&lc=e...
    I am an HP employee.
    Say Thanks by clicking the Kudos Star in the post that helped you.
    Please mark the post that solves your problem as "Accepted Solution"

  • How do you check the status of your order if you ordered from ATT store?

    I ordered on July the 2nd, but have no idea how to check my order's status. Any help would be greatly appreciated. Thanks.

    Go to AT&T order status page. You can search by your order number (which they should have provided you at the store) or by the phone number you provided them at the store. If you're a current customer, it would be your current number.
    G
    https://www.wireless.att.com/order_status/

  • How can you check the availability of iPhone 5 in Apple Stores?

    I want to check the availability of iPhone 5 in my nearest Apple Store. Is there a way I can do that online? Any links?
    (Sorry that this is in the wrong category, but I couldn't find any to match it)
    Thanks in advance,
    - Daniel 

    You could possibly try ringing the store if you want to know

  • How do you find the "iT 1.tmp" file for iTunes?

    Hello,
    I am currently having problem with my iTunes library. A couple of days ago, very randomly, most of my music and movies disappeared from my iTunes library. I had recently updated iTunes, but it was a week after the update that this happened. All of my music and movies that I had added through importing CDs or copying from a hard drive were no longer in my library, and all of the music I had purchased from iTunes had the iCloud symbol next to them, and needed to be re-downloaded to actually have them on my computer. My iPod also didn't recognise it as the same library, asking if I wanted to remove all music on it before syncing.
    The strange thing is that all of my music and movies are still in the same place; they're in the iTunes media file and everything is there, it just doesn't appear on my library. After a bit of searching I found out that others had had the same problem, and it was apparently fixed by deleting the "iTunes library.itl" file and renaming the "iT 1.tmp" file with "iTunes library.itl". The only problem is that I can't find "iT 1.tmp" anywhere.
    If anybody could help that would be amazing, as I have lost 3000 songs and I have no idea why. It would also be much too time consuming to import everything again.
    Thanks

    Hi Jonesy0309,
    I'm sorry to hear about the issues you have been having with iTunes. I also apologize, but I'm a bit unclear on the directions you were following regarding your iTunes library. If you are trying to recreate your iTunes Library file, you may find the steps outlined in the following article helpful:
    iTunes: How to re-create your iTunes library and playlists - Apple Support
    Regards,
    - Brenden

  • How do i check the size of a file?

    I want to be able to determine the size of a file in a directory. If the file has size 0kb (ie. no content), i need to be alerted to this. Is there an easy way to do this without having to read the contents of the file itself?
    thanks.

    File.length();

  • How do you check the language OS is installed in?

    Is there a way you can check what language the operating system is installed in using Java? I need to know whether my code is running on a Simplified Chinese OS, a Japanese OS, a Korean OS etc. in order to set the font to one that will display the characters.
    I checked out System.getProperties but may be going in the wrong direction. Any advice?
    Thanks.

    System.out.println(System.getProperty("user.language") + " " +System.getProperty("file.encoding"));                                                                                                                                                                                                       

  • How do you change the default permissions for files?

    I have all my users saving (via AFP) to an Xserve RAID, I am using ACL to control who has access to certain area.
    This is fine when moving files in the finder, all ACL are respected, however when saving files from Photoshop it ignores the ACL's.
    So if user A saves a file they become the owner- which is fine, but the group and everyone permissions are read only, so when user B ammends the file they get a permission warning when they try to save, the work round I'm using is to trash the file just before you try to save- not ideal cos if the save fails you've lost the work.
    What I would like is for the default permission to be group "design" Read and Write and leave everyone as read only
    So when any designer goes to oversave a file in photoshop they can do.
    I needf to leave ACL's on as they are working well in every other situation, i.e I have certain folders set so once images have been added they cannot be deleted or renamed by certain users.
    It only seems to be Photoshop that gives us this problem, Quark files and other docs are able to be saved according to the ACL

    Hi
    There are some important distinctions and points to be made here.
    POSIX Permissions are always set for every file and folder. ACLs are optional for any file, folder or share point and work IN ADDITION to POSIX Permissions. SACLs (Service Access Control Lists) are optional for specific services such as AFP, FTP, SMB, Mail etc and are independent of files and folder as well of standard POSIX Permissions and file system ACLs. Allow access is cumulative and Deny access is first match.
    ACLs supersede but don’t necessarily override Standard UNIX permissions.
    The best way to use ACLs is to enable Access Control Lists on the desired volume, create the share point folder from within Workgroup Manager, define the Users and Groups and then drop the relevant User and/or Group into the ACL window and define access privileges from there. Don’t be tempted to use the Standard UNIX permissions in addition to ACLs as all sorts of problems can ensue.
    Privileges and access can quickly get confused and share points can be broken. Deny settings defined in ACL take precedence over all other privileges settings. Deny settings defined using Standard UNIX as well as ACLs can, in some cases, mean share points becoming inaccessible to all users even those with administrative privileges.
    Wherever possible try not to set access privileges using the Finder.
    For a much fuller explanation and a method for calculating umask values consult Gerrit de Witt’s series of articles:
    http://discussions.apple.com/thread.jspa?messageID=648307&#648307

  • How do you reduce the size of a file

    PLEASE HELP
    I'm so new to Premiere Pro I don't know what I'm doing. I received a file on a DVD (10 GB ) in a vob format and all I wanted to do was create a small 1 minute clip.
    When I got the sequence I wanted I tried to export the file and it ended up to be 300 MB.
    How do I get a manageable file size.  And what the heckk is VOB
    I'm dying here.
    Please HELP

    Here are some Tutorials
    http://forums.adobe.com/thread/913334
    http://forums.adobe.com/thread/845731
    http://forums.adobe.com/message/3234794
    A "crash course" http://forums.adobe.com/thread/761834
    A Video Primer for Premiere http://forums.adobe.com/thread/498251
    Premiere Tutorial http://forums.adobe.com/thread/424009
    And http://forums.adobe.com/message/2738611
    And http://blogs.adobe.com/premiereprotraining/2010/06/video_tutorials_didacticiels_t.html
    And http://blogs.adobe.com/premiereprotraining/2010/06/how_to_search_for_premiere_pro.html
    And http://bellunevideo.com/tutlist.php
    Premiere Pro Wiki http://premierepro.wikia.com/wiki/Main_Page
    Tutorial http://www.tutorialized.com/tutorials/Premiere/1
    Tutorial http://www.dvxuser.com/V6/forumdisplay.php?f=21
    Tutorial HD to SD w/CS4 http://bellunevideo.com/tutorials/CS4_HD2SD/CS4_HD2SD.html
    Exporting to DVD http://help.adobe.com/en_US/premierepro/cs/using/WS3E252E59-6BE5-4668-A12E-4ED0348C3FDBa.h tml
    And http://help.adobe.com/en_US/premierepro/cs/using/WSCDE15B03-1236-483f-BBD4-263E77B445B9.ht ml
    Color correction http://forums.adobe.com/thread/892861
    After Effects Tutorials http://www.videocopilot.net/
    Surround Sound http://forums.adobe.com/thread/517372
    Photo Scaling for Video http://forums.adobe.com/thread/450798
    -Too Large May = Crash http://forums.adobe.com/thread/879967
    -And another crash report http://forums.adobe.com/thread/973935
    CS6 http://www.dvxuser.com/V6/showthread.php?282290-New-Tutorial-Working-Faster-in-Premiere-Pr o-CS6
    Encore http://tv.adobe.com/show/learn-encore-cs4/
    Authoring http://www.videocopilot.net/tutorials/dvd_authoring/
    Encore Tutorial http://www.precomposed.com/blog/2009/05/encore-tutorial/
    And more Encore http://library.creativecow.net/articles/devis_andrew/
    Regions and NTSC vs PAL http://forums.adobe.com/thread/951042
    Also, the user guide as a PDF
    http://blogs.adobe.com/adobecustomersuccess/2011/05/14/help-support-pages-for-creative-sui te-applications/

  • I'm new to icloud and can't see the value. where is a good place to go to find out how to use it? also how can you restore the backup of original files.

    I am new to icloud. where can a I go to learn how to restore backup to my PC?

    See Here...
    iCloud Backup and Restore Overview
    http://support.apple.com/kb/HT4859?viewlocale=en_US
    And Here...
    iCloud Help
    http://help.apple.com/icloud/?lang=en

  • How do you empty the trash if a file is in use

    I somehow deleted a file although it was in use.  Part of Time Machine.  Now I can't empty the trash.
    Any hlep would be appreciated
    Thanks,

    Take a look at this resource (in particular: E6):
    http://pondini.org/TM/Troubleshooting.html

  • HT204408 How do you access the /private/etc/hosts file?

    My facetime keeps saying that "There was an error processing registration.." I've called apple support, they didn't know what else to do either, my last choice is looking through my files, especially the host file. Can anyone help?

    sudo nano /etc/hosts
    once your done
    ctrl+o then crtl+x

  • I get a message that says ff is already running but is not responding ,to open a new window, you must close the existing ff process or restart your system, how do i close the existing ff process?

    I have windows 7 on dell laptop. I am working on a Word Document and want to go to a diff window for some information. I click on the FF icon on my desktop and get a message that says...FF is already running but is not responding. To open a new window, you must close the existing ff process or restart your system..how do you close the existing ff process?
    == This happened ==
    Every time Firefox opened
    == I got my new dell laptop four weeks ago with window 7 installed

    See https://support.mozilla.com/en-US/kb/Firefox+is+already+running+but+is+not+responding

Maybe you are looking for