Browsing all articles tagged with cli
Nov
18

Tip: Using find Command in Linux

Author Rai    Category Linux     Tags , , , , ,

Doing command-line stuff in Linux is fun. It may be intimidating for some at first, now that we are in the age where GUI is no longer an option. But with CLI, we can do so many things that can be accomplished faster if we know how to utilize the features of a certain command.

One command that is very flexible is find. With find, you can search not only based on filenames, you can also use other identifiers like GUI and UID, timestamps and file types.

Here are some examples of find commands:

This command will find all files in /home directory with .doc as extension and was modified 24 hours ago:

find /home -name *.doc -mtime 1

This one will find the same files, but not directories, and delete them using -exec option (great for disk usage maintenance, but BACKUP first!):

find /home -name *.doc -type f -mtime 1 -exec rm ’{}’ \;

You can also find files owned by a certain UID:

find /tmp -user johndoe find /tmp -uid 502

Or by GID:

find /home/development -gid 1000

You can also search for files and directories with certain permissions:

find . -perm -777

And from those examples, you can build your own command to find what you are looking for.

Apr
21

Tip: Testing Your PHP/MySQL Connection

How to test if PHP connects to MySQL database?

There are numerous times when I have to setup Apache and PHP on a freshly installed Linux server. Considering that not only that Apache service should work, I also have to make sure that PHP and MySQL are working properly together.

Forgetful that I am, I always tend to forget what components should I have to make PHP and MySQL talk to each other. You need something like a ’special glue’ to connect the two together and I will discuss here how to make PHP and MySQL work together for both RPM and source installation.
read more

Apr
16

Tip: Remove Long List of Files

How to delete long list of files in Linux?

Let’s say you have a long list of files that you want to delete and simply running rm -fv * just won’t work and Linux will let you know by giving you this error:

Argument list too long.

When you get this error, it means that the number of files is too many for the kernel to process.

There is a simple workaround for this.
read more

Powered by 1and1.comGlobat Webhosting Earn with Your BlogAdvertise @ PinoyTux

Search PinoyTux

Subscribe to Email Feeds

Enter Email Address:

Blog Lounge

Popular Posts

Recent Posts

Drop your Card Here

Recent Comments

Site Stats