LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 09-20-2007, 02:35 PM   #1
xeon123
Member
 
Registered: Sep 2006
Posts: 367

Rep: Reputation: 16
Bash command questions


Hi,

1 - I want to do a ls command, but that directs explicity to a file and to the standard output at the same time. How should i do?

2 - What means the command "ls 2>&1"? What means "2>" and "&1"?

3 - As as user, when I do a find command, sometimes appears that the find can search in a specified directory because it's belongs to root and I don't have permission. How can I make disappear this error messages, during the execution of the command?


Thanks,

Pedro
 
Old 09-20-2007, 02:56 PM   #2
pljvaldez
Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Squeeze (x86)
Posts: 6,092

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by pedrosacosta View Post
Hi,

1 - I want to do a ls command, but that directs explicity to a file and to the standard output at the same time. How should i do?
ls | tee ls.txt

Quote:
2 - What means the command "ls 2>&1"? What means "2>" and "&1"?
2>&1 basically means to output the stderr (error messages) to stdout (the screen).

Quote:
3 - As as user, when I do a find command, sometimes appears that the find can search in a specified directory because it's belongs to root and I don't have permission. How can I make disappear this error messages, during the execution of the command?
Either don't search that directory, or run the find command as root.
 
Old 09-20-2007, 03:58 PM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
Quote:
Originally Posted by pedrosacosta View Post

3 - As as user, when I do a find command, sometimes appears that the find can search in a specified directory because it's belongs to root and I don't have permission. How can I make disappear this error messages, during the execution of the command?

example:

Code:
find /    \( -perm -4000 -fprintf ~/suid.txt '%#m %u %p\n' \)  2>/dev/null
This will search the system for suid programs and output the results to a file. Errors like not being able to enter the /root directory will be redirected to /dev/null.

Last edited by jschiwal; 09-20-2007 at 04:00 PM.
 
  


Reply


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash scripting questions: Geminias Programming 3 08-06-2007 09:58 AM
bash questions xeon123 Linux - General 2 11-23-2006 06:00 AM
bash: <command name> command not found smash Programming 5 03-13-2006 09:48 AM
Bash scripting questions stryka Programming 3 11-25-2005 12:46 AM
bash scripting questions nix101 Linux - Newbie 2 09-04-2005 10:26 AM


All times are GMT -5. The time now is 08:49 AM.

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