Showing your processes in a hierarchical list is very useful for confirming the relationship between every process running on your system. Today I'd like to show you how you can get tree-like processes lists using various commands.
How-To
How To List Directories in a Directory in Unix
Another quick answer to the question I see a lot in search queries on this blog: listing directories in a directory. I take it that this question means showing a list of only the directories and not other files under a certain location of your Unix filesystem.
Using find to show only directories
find command helps you show only the directories by using a -type d parameter.
[Read more…] about How To List Directories in a Directory in Unix
How To Find a Location of a Directory in Unix
Very quick tip for you today, I just see that many of visitors of this block are curious how they can find a directory in Unix – and so here's a command to help you do just that.
Finding directories in Unix
There's nothing better than to employ the find command. As you might remember, among many things, this wonderful tool allows you to search files by their type. Since nearly everything in Unix is a file, this means you can find directories.
[Read more…] about How To Find a Location of a Directory in Unix
How To Find the Default Block Size in Unix
The questions about default block sizes used in your Unix system are always popular. Today I'd like to show you a few ways to answer them.
Default block size in Linux
If you ever want to confirm the block size of any filesystem of Ubuntu or any other Linux OS, tune2fs command is here to help:
ubuntu# tune2fs -l /dev/sda1 | grep Block Block count: 4980736 Block size: 4096 Blocks per group: 32768
From this example, you can see that the default block size for the filesystem on /dev/sda1 partition is 4096 bytes, or 4k. That's the default block size for ext3 filesystem.
Default block size in Solaris
The default block size in Solaris is 8192 bytes, or 8k. However, some architectures allow you to use 4k size as well, by specifying it as a command line option for the newfs command.
To be absolutely sure, you can use one of the commands: df -g (takes a filesystem mount point name as the parameter – / or /usr for example) or use fstyp -v command (needs a character device of the filesystem you're interested in).
Using df -g to confirm the filesystem block size
This command can be used as any user, so to confirm a block size for any of the filesystems you don't have to be root. However, it works only for mounted filesystems.
bash-3.00$ df -g / / (/dev/dsk/c1t0d0s0 ): 8192 block size 1024 frag size 12405898 total blocks 4399080 free blocks 4275022 available 751296 total files 603544 free files 30932992 filesys id ufs fstype 0x00000004 flag 255 filename length
Using fstyp -v to confirm the filesystem block size
Because this command accesses the character device of a particular filesystem, you have to be root to run it. But as a bonus compared to df -g, you can use fstyp -v on an unmounted filesystem:
bash-3.00# fstyp -v /dev/dsk/c1t0d0s0 | grep ^bsize bsize 8192 shift 13 mask 0xffffe000
How To Install 32-bit Debian Packages on 64-bit System
Many software products, especially the commercial ones, are distributed as 32-bit packages. This means that they won't be installed on your 64-bit system unless you clearly specify that you want to override the architecture dependency.
If you're using Ubuntu or any other Debian based distribution, this post will teach you how to install 32-bit deb packages on your 64-bit OS.
Is it possible to run 32-bit applications on 64-bit OS?
In Unix world, yes: it is quite possible to run 32-bit binaries on 64-bit OS. There should generally be no problem, but there are, as always, a few caveats:
How To Find Your UID From Bash
I see this question a lot in search engines requests which point to this blog. And if you're so interested how this is done, I'm happy to explain.
[Read more…] about How To Find Your UID From Bash
How To Find What Symlink Points To
To some this may seem like a trivial task, but I see great interest from Unix/Linux beginners arriving to this blog: how exactly does one confirm what a symlink points to?
First of all, if you haven't already done so – read my Unix Symlink Example post to learn what a symlink is and to refresh your mind about creating symlinks.
How To Find the Largest Files in your Unix system
I see that my Finding Large Files and Directories post is quite popular, yet there are a few more ways to simplify your search for the largest disk space consumers in your Unix system.
Make find command show file sizes
If you remember, the default way a find command reports results includes only the fully qualified (that means including the full path) filenames.
Now, if you look at a task of identifying the largest files, it's great if you can get a list of all the files bigger than some figure your specify, but what would be even better is to include the exact size of each file right into the output of the find command.
[Read more…] about How To Find the Largest Files in your Unix system
How to Find the Owner of a File in Unix
Surprisingly, I see quite a few questions around file ownership asked all the time. And one of the first questions asked concerns the Unix user who owns a particular file.
It's very easy to confirm who the owner of a file is, and you can do it using the ls command.
[Read more…] about How to Find the Owner of a File in Unix
How To Find Large Files and Directories in Unix
When you're trying to clean up your filesystems and reclaim some space, one of the first things you'll want to do is to confirm the largest directories and individual files you have. This can be easily done using two Unix commands: find command and du command.
Find files larger than a certain size
It's very simply to find files which are larger than a specified size. The find command accepts a size parameter, and you can specify the limits for file sizes in your command line.
[Read more…] about How To Find Large Files and Directories in Unix