This answer probably goes deeper than the use case warrants, and find 2>/dev/null may be good enough in many situations.GNU find in particular has a myriad options not available in other versions - see the currently accepted answer for one such set of options. If you wish to adapt to the specific version of find you have on your system, there may be alternative options available. This will work on any variant of Unix with any Bourne shell derivative (Bash, Korn, …) and any POSIX-compliant version of find. There are endless variations on this theme, depending on what you want to do. The final redirection could be regarded as optional at the terminal, but would be a very good idea to use it in a script so that error messages appear on standard error. The grep filters the standard output (you can decide how selective you want it to be, and may have to change the spelling depending on locale and O/S) and the final >&2 means that the surviving error messages (written to standard output) go to standard error once more. The net result is that messages written to standard error are sent down the pipe and the regular output of find is written to the file. The > files_and_folders sends standard output (but not standard error) to a file. The 2>&1 sends standard error to the same place as standard output (the pipe). The pipe redirects standard output to the grep command and is applied first. The I/O redirection on the find command is: 2>&1 > files_and_folders |. 2>&1 > files_and_folders | grep -v 'Permission denied' >&2 If you strictly want to filter just standard error, you can use the more elaborate construction: find. 2>&1 | grep -v 'Permission denied' > files_and_folders If you really want to keep other possible errors, such as too many hops on a symlink, but not the permission denied ones, then you'd probably have to take a flying guess that you don't have many files called 'permission denied' and try: find. This hides not just the Permission denied errors, of course, but all error messages. The openvt command creates a new virtual console, which can only be done by root and isn't used very often in this century since most people only ever work in a graphical window environment.Use: find. The open command you encountered is an older name for the openvt command (some Linux distributions only include it under the name openvt). Replace … by the path where the sublime_text executable is, of course. It's really the job of the makers of Sublime Text to make this automatic, but if they haven't done it, you can probably do it yourself by running the command sudo -s …/sublime_text /usr/local/bin deb or rpm), so it's possible that you need to do an extra installation step. I've never used it, and apparently it comes as a tar archive, not as a distribution package (e.g. If running the command sublime_text shell doesn't work for you, then Sublime Text hasn't been installed properly. Linux doesn't have any application database, but it's organized in such a way that it doesn't need one. OS X needs an extra level of indirection, through open -a, to handle applications which are unpacked in a single directory tree and registered in an application database. For example, all executable programs are in a small set of directories and all those directories are listed in the PATH variable running sublime_text looks up a file called sublime_text in the directories listed in PATH. Linux, like other Unix systems (but not, as far as I know, the non-Unixy parts of OS X) manages software by tracking it with a package manager, and puts individual files where they are used. More precisely, you need to type the name of the executable program that implements the application. That's because the normal way to open a file in an application is to simply type the name of the application followed by the name of the file. Xdg-open doesn't have an equivalent of OSX's open -a to open a file in specific application. The equivalent of that on modern non-OSX unices is xdg-open. The primary purpose of OS X's open command is to open a file in the associated application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |