Friday, February 1, 2013

How to capture C and CPP files in the linux operating system?

Q. I am new to linux and have been trying to figure this out forever for a homework assignment! I am supposed to use appropriate linux commands to capture all "C or CPP" files in the linux operating system and make a list of the files. I am using Xubuntu. I am a beginner and could use any advice! Thanks!

A. What does it mean to capture a file??

If you mean to find the files and list the results, use the 'find' command to search for *.c and *.cpp files in the whole system. You will get the result on the screen, and you can redirect the output to a file.

To find *.c files:
find / -name *.c

To find *.cpp files:
find / -name *.cpp

Explanation: the "/" means to start the search at the top of the file system, meaning that the search will include all the system. The "-name" means to search by name, and "*.c" is the file pattern you want to find.

To redirect the output, use "> output_file" for example:
find / -name *.cpp > output_file

Hope it helps. See the manual page 'man find' to learn more.

How do I add an FTP user with a Linux command?
Q. I need to write a PHP script that automatically adds FTP users. I can use the system() function to run a Linux command, but I don't know how to create a new FTP user. Any help here?
I don't own the server, I've purchased a reseller plan.

A. When you say add an ftp user, I assume that you wouldn't want the person to be able to log in to a shell on the system. FTP users are just like any other linux user. Use the adduser(sometimes called useradd) command and pay attention to the --shell switch (set to /bin/false)

how to open a url from linux command line?
Q. I want to run a url from the linux command lline. So, please help me with the command.

A. You could use lynx or links. Both are text-based browsers.

Alternatively, you could use wget which will retrieve the url you pass to it.



Nec Projector Review

Plastic Shed Reviews

Ati Graphic Reviews

Nurse Uniforms Reviews

Cabochons Reviews

Inflatable Water Slides Reviews

Barcode Scanner Reviews

No comments:

Post a Comment