Once you've downloaded an ISO Image you can mount it as a loopback device. This will give you access to the files in the ISO without you having to burn it to a CDROM first. In order to do this you must have loopback compiled into your Linux Kernel. (Most newer distributions will have this enabled by default). For example if you wanted to mount filename.iso to /mnt/iso you would run the following command: mount -o loop -t iso9660 filename.iso /mnt/iso
Total Pageviews
Showing posts with label linux common. Show all posts
Showing posts with label linux common. Show all posts
Saturday, April 14, 2012
Zombie process
When you run the ps command, those processes (if any) that have a status of Z are called "zombies".
Naturally, when people see a zombie process, the first thing that many try to do is to kill the zombie, using kill or (horrors!) kill -9. This won't work, however: you can't kill a zombie, it's already dead ;-)
When a process has been terminated ("died") by recieving the TERM signal to do so, it needs to stick around for a bit to finish up a few last tasks. These include closing open files and shutting down any allocated resources (memory, swap space, that sort of thing). These "housekeeping" tasks are supposed to happen very quickly. Once they're completed, the final thing that a process has to do before dying is to report its exit status to its parent. This is generally where things go wrong.
Each process is assigned a unique Process ID (PID). Each process also has an associated parent process ID (PPID), which identifies the process that spawned it (or a PPID of 1, meaning that the process has been inherited by the init process, if the parent has already terminated). While the parent is still running, it remembers the PIDs of all the children it has spawned. These PIDs can not be re-used by other (new) processes until the parent knows for certain that the child process is done.
When a child terminates and has completed its housekeeping tasks, it sends a one-byte status code to its parent (thus we have 256 possible exit codes, zero being the usual indicator of "everything went great"). If this status code never gets sent, the PID is kept alive (in "zombie" status) in order to reserve its PID number ... the parent is waiting for the status code, and until it gets it, it doesn't want any new processes to try and reuse that PID number for themselves, just in case.
To get rid of a zombie, you should try killing its parent (PPID), which will temporarily orphan the zombie. The init process will then inherent the zombie, and this might allow the process to finish terminating since the init process is always in a wait() state (i.e., ready to receive exit status reports from its children).
Generally, though, zombies clean themselves up. Whatever it is that the process was waiting for eventually occurs and the process can report its exit status to its parent and all is well.
If a zombie is already owned by init, though, and it's still sticking around (like the undead are wont to do ;-) ), then the process is almost certainly stuck in a device driver close routine, and will likely remain that way forever. You can reboot to clear out the zombies, but fixing the device driver is the only permanent solution. Killing the parent (init in this case) is definitely not recommended, since init is an extremely important process to keeping your system running.
Naturally, when people see a zombie process, the first thing that many try to do is to kill the zombie, using kill or (horrors!) kill -9. This won't work, however: you can't kill a zombie, it's already dead ;-)
When a process has been terminated ("died") by recieving the TERM signal to do so, it needs to stick around for a bit to finish up a few last tasks. These include closing open files and shutting down any allocated resources (memory, swap space, that sort of thing). These "housekeeping" tasks are supposed to happen very quickly. Once they're completed, the final thing that a process has to do before dying is to report its exit status to its parent. This is generally where things go wrong.
Each process is assigned a unique Process ID (PID). Each process also has an associated parent process ID (PPID), which identifies the process that spawned it (or a PPID of 1, meaning that the process has been inherited by the init process, if the parent has already terminated). While the parent is still running, it remembers the PIDs of all the children it has spawned. These PIDs can not be re-used by other (new) processes until the parent knows for certain that the child process is done.
When a child terminates and has completed its housekeeping tasks, it sends a one-byte status code to its parent (thus we have 256 possible exit codes, zero being the usual indicator of "everything went great"). If this status code never gets sent, the PID is kept alive (in "zombie" status) in order to reserve its PID number ... the parent is waiting for the status code, and until it gets it, it doesn't want any new processes to try and reuse that PID number for themselves, just in case.
To get rid of a zombie, you should try killing its parent (PPID), which will temporarily orphan the zombie. The init process will then inherent the zombie, and this might allow the process to finish terminating since the init process is always in a wait() state (i.e., ready to receive exit status reports from its children).
Generally, though, zombies clean themselves up. Whatever it is that the process was waiting for eventually occurs and the process can report its exit status to its parent and all is well.
If a zombie is already owned by init, though, and it's still sticking around (like the undead are wont to do ;-) ), then the process is almost certainly stuck in a device driver close routine, and will likely remain that way forever. You can reboot to clear out the zombies, but fixing the device driver is the only permanent solution. Killing the parent (init in this case) is definitely not recommended, since init is an extremely important process to keeping your system running.
Deleting / Creating files name starting with hyphens
We usually find files that were created accidentally, that was named starting with hyphens, like -filename.
You cannot simply type rm -filename as the command line parser treats the filename as a command line switch. There are other characters that work the same way, like #, which gets created by some text editors as a backup file, e.g., #myfile#.
A simple way to delete these files is to find another way to access them so the special character isnt the first character after the whitespace. This can be done by referencing them via their path location, or most simply by preceding the filename with ./ which is the current directory.
The files in the above examples can be deleted with the following commands:
$ rm ./--filename
$rm ./#myfile#
You can also delete files having special name in their filenames with inode number.
Ex:
> ls -li ==> first column is inode num
> find . -inum -exec rm {} ;
You cannot simply type rm -filename as the command line parser treats the filename as a command line switch. There are other characters that work the same way, like #, which gets created by some text editors as a backup file, e.g., #myfile#.
A simple way to delete these files is to find another way to access them so the special character isnt the first character after the whitespace. This can be done by referencing them via their path location, or most simply by preceding the filename with ./ which is the current directory.
The files in the above examples can be deleted with the following commands:
$ rm ./--filename
$rm ./#myfile#
You can also delete files having special name in their filenames with inode number.
Ex:
> ls -li ==> first column is inode num
> find . -inum -exec rm {} ;
Friday, April 13, 2012
tar file operations
Append files to tar :-->
[10:49pm agvarghe@sjc-ads-1011:20I]>tar -rvf pies.tar 2.pie 3.pie
2.pie
3.pie
[10:50pm agvarghe@sjc-ads-1011:20I]>
Task: List the contents of a tar file
Use the following command:
$ tar -tvf file.tar
Task: List the contents of a tar.gz file
Use the following command:
$ tar -ztvf file.tar.gz
Task: List the contents of a tar.bz2 file
Use the following command:
$ tar -jtvf file.tar.bz2
Extracting Specific Files
tar -xvf {tarball.tar} {path/to/file}
tar -C /myfolder -zxvf yourfile.tar to extract to another directory
The --delete option allows specified files to be completely removed from a tar file (except when the tar file is on magnetic tape). However, this is different from an extraction, as copies of the removed files are not made and placed in the current directory. Thus, for example, the files file1 and file2 can be removed from file.tar with the following:
tar -f file.tar --delete file1 file2
[10:49pm agvarghe@sjc-ads-1011:20I]>tar -rvf pies.tar 2.pie 3.pie
2.pie
3.pie
[10:50pm agvarghe@sjc-ads-1011:20I]>
Task: List the contents of a tar file
Use the following command:
$ tar -tvf file.tar
Task: List the contents of a tar.gz file
Use the following command:
$ tar -ztvf file.tar.gz
Task: List the contents of a tar.bz2 file
Use the following command:
$ tar -jtvf file.tar.bz2
Extracting Specific Files
tar -xvf {tarball.tar} {path/to/file}
tar -C /myfolder -zxvf yourfile.tar to extract to another directory
The --delete option allows specified files to be completely removed from a tar file (except when the tar file is on magnetic tape). However, this is different from an extraction, as copies of the removed files are not made and placed in the current directory. Thus, for example, the files file1 and file2 can be removed from file.tar with the following:
tar -f file.tar --delete file1 file2
View file in zip without unzipping
unzip -l ULTRA-1.zip
unzip -p ULTRA-1.zip <filename displayed from above step> | more
unzip -p ULTRA-1.zip <filename displayed from above step> | more
Thursday, April 12, 2012
Change the MAC address
$ ifconfig -a | grep HWaddr
eth0 Link encap:Ethernet HWaddr 00:80:48:BA:d1:20
# ifconfig eth0 down
# ifconfig eth0 hw ether 00:80:48:BA:d1:30
# ifconfig eth0 up
# ifconfig eth0 |grep HWaddr
Find command Usage
find files with name -->
find / -name Chapter1 -type f
find /usr /home -name Chapter1 -type f
find /usr -name "Chapter*" -type f
find directory -->
find . -type d -name build
all files that end with the extension .java, and contain findString -->
find . -type f -name "*.java" -exec grep -l findString {} \;
use the -i argument to the grep command, telling it to ignore the case of search string -->
find . -type f -name "*.java" -exec grep -il string {} \;
Acting on files that are found : files are found, their permission is changed to mode 644 -->
find /usr/local -name "*.html" -type f -exec chmod 644 {} \;
Print with file last modification time,size etc -->
find . -name "*.pl" -exec ls -ld {} \;
Case-insensitive file searching -->
find . -iname foo
Depth and size usage -->
find -L . -maxdepth 2 -type f -size 0
find / -name Chapter1 -type f
find /usr /home -name Chapter1 -type f
find /usr -name "Chapter*" -type f
find directory -->
find . -type d -name build
all files that end with the extension .java, and contain findString -->
find . -type f -name "*.java" -exec grep -l findString {} \;
use the -i argument to the grep command, telling it to ignore the case of search string -->
find . -type f -name "*.java" -exec grep -il string {} \;
Acting on files that are found : files are found, their permission is changed to mode 644 -->
find /usr/local -name "*.html" -type f -exec chmod 644 {} \;
Print with file last modification time,size etc -->
find . -name "*.pl" -exec ls -ld {} \;
Case-insensitive file searching -->
find . -iname foo
Depth and size usage -->
find -L . -maxdepth 2 -type f -size 0
shebang/hashbang
In computing, a shebang (also called a hashbang, hashpling, or pound bang) refers to the characters "#!"
when they are the first two characters in a text file. Unix-like
operating systems take the presence of these two characters as an
indication that the file is a script, and try to execute that script
using the interpreter specified by the rest of the first line in the
file. For instance, shell scripts for the Bourne shell start with the
first line:
#!/bin/sh
when they are the first two characters in a text file. Unix-like
operating systems take the presence of these two characters as an
indication that the file is a script, and try to execute that script
using the interpreter specified by the rest of the first line in the
file. For instance, shell scripts for the Bourne shell start with the
first line:
#!/bin/sh
To find how many times a string occurs in all files
grep -c string *
to get only files that have one or more occurrence:
grep -c string * | grep -v :0
for multiple occurrences per line:
grep -o string * | wc -l
to get only files that have one or more occurrence:
grep -c string * | grep -v :0
for multiple occurrences per line:
grep -o string * | wc -l
compression and archiving
On unix, compression is separate from archiving.Tar is an archiver, meaning it would archive multiple files into a single file but without compression.
tar command is short for tape archiving
To combine multiple files and/or directories into a single file, use the following command:
tar -cvf file.tar inputfile1 inputfile2
Replace inputfile1 and inputfile2 with the files and/or directories you want to combine. You can use any name in place of file.tar, though you should keep the .tar extension. If you don't use the f option, tar assumes you really do want to create a tape archive instead of joining up a number of files. The v option tells tar to be verbose, which reports all files as they are added.
To separate an archive created by tar into separate files, at the shell prompt, enter:
tar -xvf file.tar
gzip (the GNU file compression program).Gzip compress the size of the given files using Lempel-Ziv coding (LZ77)
tar -cvzf file.tar.gz inputfile1 inputfile2
Here, the z option tells tar to zip the archive as it is created. To unzip such a zipped tar file, enter:
tar -xvzf file.tar.gz
Lastly, the extensions .tgz and .tar.gz are equivalent; they both signify a tar file zipped with gzip.
Bzip2 is a compression format that has better compression than both zip, and gzip.bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. Compression is generally considerably better than that achieved by bzip command (LZ77/LZ78-based compressors).
bzip2 *.jpg
bzip2 -d mydata.doc.bz2
zip is a compression and file packaging utility for Unix/Linux. Each file is stored in single .zip {.zip-filename} file with the extension .zip.
zip data.zip *.doc
unzip file.zip
tar xvzf file-1.0.tar.gz - for uncompress a gzip tar file (.tgz or .tar.gz)
tar xvjf file-1.0.tar.bz2 - for uncompress a bzip2 tar file (.tbz or .tar.bz2)
tar xvf file-1.0.tar - for uncompressed tar file (.tar)
x = eXtract, this indicated an extraction ( c = create to create )
v = verbose (optional) the files with relative locations will be displayed.
z = gzip-ped; j = bzip2-zipped
tar command is short for tape archiving
To combine multiple files and/or directories into a single file, use the following command:
tar -cvf file.tar inputfile1 inputfile2
Replace inputfile1 and inputfile2 with the files and/or directories you want to combine. You can use any name in place of file.tar, though you should keep the .tar extension. If you don't use the f option, tar assumes you really do want to create a tape archive instead of joining up a number of files. The v option tells tar to be verbose, which reports all files as they are added.
To separate an archive created by tar into separate files, at the shell prompt, enter:
tar -xvf file.tar
gzip (the GNU file compression program).Gzip compress the size of the given files using Lempel-Ziv coding (LZ77)
tar -cvzf file.tar.gz inputfile1 inputfile2
Here, the z option tells tar to zip the archive as it is created. To unzip such a zipped tar file, enter:
tar -xvzf file.tar.gz
Lastly, the extensions .tgz and .tar.gz are equivalent; they both signify a tar file zipped with gzip.
Bzip2 is a compression format that has better compression than both zip, and gzip.bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. Compression is generally considerably better than that achieved by bzip command (LZ77/LZ78-based compressors).
bzip2 *.jpg
bzip2 -d mydata.doc.bz2
zip is a compression and file packaging utility for Unix/Linux. Each file is stored in single .zip {.zip-filename} file with the extension .zip.
zip data.zip *.doc
unzip file.zip
tar xvzf file-1.0.tar.gz - for uncompress a gzip tar file (.tgz or .tar.gz)
tar xvjf file-1.0.tar.bz2 - for uncompress a bzip2 tar file (.tbz or .tar.bz2)
tar xvf file-1.0.tar - for uncompressed tar file (.tar)
x = eXtract, this indicated an extraction ( c = create to create )
v = verbose (optional) the files with relative locations will be displayed.
z = gzip-ped; j = bzip2-zipped
How to find deleted files using EXT3GREP
1. Installing ext3grep…
wget http://ext3grep.googlecode.com/files/ext3grep-0.7.0.tar.gz
tar -xvzf ext3grep-0.7.0.tar.gz
cd ext3grep
./configure
make
cd src
./ext3grep –help
Done, ext3grep is built and working
3.Lets search for deleted folder:
Eg: ./ext3grep /dev/hda1 –search uaconsoleclientsample
Ext3grep
will find many deleted blocks, now we need to check each blocks to find
exact block associated with our deleted folder.
4.Find exact block assosicated with our deleted folder by checking each block
Eg: ./ext3grep /dev/hda1 –ls –block 240017
Use this script to automate this checking process.
#!/bin/sh
blocks=“255079 336393 336518 336526 395434 395435 395457 737282
984250 1346129 1868670 1869273 1950436 3915933 3915935 4069411 4087953
4216611 4292193 4292196 4292275 4530219 4538370 4538371 4538372 4538376
4538378 4538382 4538385 4543743 4543750 4543752 4544514 4544517 4544528
4544539 4550683 4550707 4655509 4655533 4670417 4670423 4689385 4689746
4785120 5046823 6525842 7370457 7805912“
# Replace above blocks with blocks found in step 3
for block in $blocks; do
./ext3grep /dev/hda1 –ls –block $block | tee -a output.txt
done
This script does the same procedure for each block in the
list, shows the output on console and writes it to the file output.txt
using tee. This way you can recheck the result later also in vim.
Analyze the output.txt and find entries like
"Block 1869273 is a directory. The block is Allocated" and find all inode associated with this block
5.Check content of the block with inode from previous step
Eg: ./ext3grep /dev/hda1 –ls –inode 656495
6.Now just restore the files you want using the right inode.
Eg: ./ext3grep /dev/hda1 –restore-inode 22633089)
wget http://ext3grep.googlecode.com/files/ext3grep-0.7.0.tar.gz
tar -xvzf ext3grep-0.7.0.tar.gz
cd ext3grep
./configure
make
cd src
./ext3grep –help
Done, ext3grep is built and working
3.Lets search for deleted folder:
Eg: ./ext3grep /dev/hda1 –search uaconsoleclientsample
Ext3grep
will find many deleted blocks, now we need to check each blocks to find
exact block associated with our deleted folder.
4.Find exact block assosicated with our deleted folder by checking each block
Eg: ./ext3grep /dev/hda1 –ls –block 240017
Use this script to automate this checking process.
#!/bin/sh
blocks=“255079 336393 336518 336526 395434 395435 395457 737282
984250 1346129 1868670 1869273 1950436 3915933 3915935 4069411 4087953
4216611 4292193 4292196 4292275 4530219 4538370 4538371 4538372 4538376
4538378 4538382 4538385 4543743 4543750 4543752 4544514 4544517 4544528
4544539 4550683 4550707 4655509 4655533 4670417 4670423 4689385 4689746
4785120 5046823 6525842 7370457 7805912“
# Replace above blocks with blocks found in step 3
for block in $blocks; do
./ext3grep /dev/hda1 –ls –block $block | tee -a output.txt
done
This script does the same procedure for each block in the
list, shows the output on console and writes it to the file output.txt
using tee. This way you can recheck the result later also in vim.
Analyze the output.txt and find entries like
"Block 1869273 is a directory. The block is Allocated" and find all inode associated with this block
5.Check content of the block with inode from previous step
Eg: ./ext3grep /dev/hda1 –ls –inode 656495
6.Now just restore the files you want using the right inode.
Eg: ./ext3grep /dev/hda1 –restore-inode 22633089)
Formatting a file system in Linux
agnel@agnel-desktop:~$ sudo fdisk -l
[sudo] password for agnel:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x21392138
Device Boot Start End Blocks Id System
/dev/sda1 * 63 40965749 20482843+ 7 HPFS/NTFS/exFAT
/dev/sda2 40965750 82911464 20972857+ 83 Linux
/dev/sda3 82911465 292623974 104856255 83 Linux
/dev/sda4 292624036 976768064 342072014+ 5 Extended
/dev/sda5 292624038 397480229 52428096 7 HPFS/NTFS/exFAT
/dev/sda6 397480293 502336484 52428096 7 HPFS/NTFS/exFAT
/dev/sda7 502336548 544282199 20972826 83 Linux
/dev/sda8 544282263 586227914 20972826 83 Linux
/dev/sda9 586227978 628173629 20972826 82 Linux swap / Solaris
/dev/sda10 628173693 976768064 174297186 83 Linux
Disk /dev/sdb: 8000 MB, 8000110592 bytes
160 heads, 19 sectors/track, 5139 cylinders, total 15625216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe2b1ddc1
Device Boot Start End Blocks Id System
/dev/sdb1 * 32 15625215 7812592 b W95 FAT32
agnel@agnel-desktop:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda7 20641788 8828556 10764592 46% /
udev 4088092 4 4088088 1% /dev
tmpfs 1638404 1048 1637356 1% /run
none 5120 0 5120 0% /run/lock
none 4096008 1736 4094272 1% /run/shm
/dev/sda10 163390464 154911308 4993216 97% /FILMS
/dev/sda1 20482840 7882284 12600556 39% /C
/dev/sda6 52428092 49347808 3080284 95% /MISC
/dev/sda5 52428092 35624236 16803856 68% /TUT
/dev/sda8 19660220 13460128 5780636 70% /HOME
/dev/sda3 103210972 78500344 19467816 81% /VIRT
/dev/sdb1 7797344 2321556 5475788 30% /media/SAM
agnel@agnel-desktop:~$ sudo umount /media/SAM
agnel@agnel-desktop:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda7 20641788 8828800 10764348 46% /
udev 4088092 4 4088088 1% /dev
tmpfs 1638404 1048 1637356 1% /run
none 5120 0 5120 0% /run/lock
none 4096008 1736 4094272 1% /run/shm
/dev/sda10 163390464 154911308 4993216 97% /FILMS
/dev/sda1 20482840 7882284 12600556 39% /C
/dev/sda6 52428092 49347808 3080284 95% /MISC
/dev/sda5 52428092 35624236 16803856 68% /TUT
/dev/sda8 19660220 13460128 5780636 70% /HOME
/dev/sda3 103210972 78500344 19467816 81% /VIRT
agnel@agnel-desktop:~$ mkfs.vfat /dev/sdb1
mkfs.vfat 3.0.9 (31 Jan 2010)
/dev/sdb1: Permission denied
agnel@agnel-desktop:~$ sudo mkfs.vfat /dev/sdb1
mkfs.vfat 3.0.9 (31 Jan 2010)
agnel@agnel-desktop:~$
[sudo] password for agnel:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x21392138
Device Boot Start End Blocks Id System
/dev/sda1 * 63 40965749 20482843+ 7 HPFS/NTFS/exFAT
/dev/sda2 40965750 82911464 20972857+ 83 Linux
/dev/sda3 82911465 292623974 104856255 83 Linux
/dev/sda4 292624036 976768064 342072014+ 5 Extended
/dev/sda5 292624038 397480229 52428096 7 HPFS/NTFS/exFAT
/dev/sda6 397480293 502336484 52428096 7 HPFS/NTFS/exFAT
/dev/sda7 502336548 544282199 20972826 83 Linux
/dev/sda8 544282263 586227914 20972826 83 Linux
/dev/sda9 586227978 628173629 20972826 82 Linux swap / Solaris
/dev/sda10 628173693 976768064 174297186 83 Linux
Disk /dev/sdb: 8000 MB, 8000110592 bytes
160 heads, 19 sectors/track, 5139 cylinders, total 15625216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe2b1ddc1
Device Boot Start End Blocks Id System
/dev/sdb1 * 32 15625215 7812592 b W95 FAT32
agnel@agnel-desktop:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda7 20641788 8828556 10764592 46% /
udev 4088092 4 4088088 1% /dev
tmpfs 1638404 1048 1637356 1% /run
none 5120 0 5120 0% /run/lock
none 4096008 1736 4094272 1% /run/shm
/dev/sda10 163390464 154911308 4993216 97% /FILMS
/dev/sda1 20482840 7882284 12600556 39% /C
/dev/sda6 52428092 49347808 3080284 95% /MISC
/dev/sda5 52428092 35624236 16803856 68% /TUT
/dev/sda8 19660220 13460128 5780636 70% /HOME
/dev/sda3 103210972 78500344 19467816 81% /VIRT
/dev/sdb1 7797344 2321556 5475788 30% /media/SAM
agnel@agnel-desktop:~$ sudo umount /media/SAM
agnel@agnel-desktop:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda7 20641788 8828800 10764348 46% /
udev 4088092 4 4088088 1% /dev
tmpfs 1638404 1048 1637356 1% /run
none 5120 0 5120 0% /run/lock
none 4096008 1736 4094272 1% /run/shm
/dev/sda10 163390464 154911308 4993216 97% /FILMS
/dev/sda1 20482840 7882284 12600556 39% /C
/dev/sda6 52428092 49347808 3080284 95% /MISC
/dev/sda5 52428092 35624236 16803856 68% /TUT
/dev/sda8 19660220 13460128 5780636 70% /HOME
/dev/sda3 103210972 78500344 19467816 81% /VIRT
agnel@agnel-desktop:~$ mkfs.vfat /dev/sdb1
mkfs.vfat 3.0.9 (31 Jan 2010)
/dev/sdb1: Permission denied
agnel@agnel-desktop:~$ sudo mkfs.vfat /dev/sdb1
mkfs.vfat 3.0.9 (31 Jan 2010)
agnel@agnel-desktop:~$
Wednesday, April 11, 2012
Shared library management with ldconfig
Ldconfig is a basic system program which determines run-time
linkbindings between ld.so and shared libraries. Ldconfig scans a
running system and sets up the symbolic links that are used to load
shared libraries properly. It also creates a cache (/etc/ld.so.cache)
which speeds the loading of programs which use shared libraries.
To see lib used by a binary
[root@nsetcindia-web ~]# ldd /usr/bin/curl-loader
libdl.so.2 => /lib64/libdl.so.2 (0x0000003b47e00000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003b48600000)
librt.so.1 => /lib64/librt.so.1 (0x0000003b48e00000)
libz.so.1 => /usr/lib64/libz.so.1 (0x0000003b48a00000)
libcares.so.2 => not found
libc.so.6 => /lib64/libc.so.6 (0x0000003b47a00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003b47600000)
[root@nsetcindia-web ~]#
Add your custom lib locations to /etc/ld.so.conf
and do
ldconfig
To see
ldconfig -p | less
linkbindings between ld.so and shared libraries. Ldconfig scans a
running system and sets up the symbolic links that are used to load
shared libraries properly. It also creates a cache (/etc/ld.so.cache)
which speeds the loading of programs which use shared libraries.
To see lib used by a binary
[root@nsetcindia-web ~]# ldd /usr/bin/curl-loader
libdl.so.2 => /lib64/libdl.so.2 (0x0000003b47e00000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003b48600000)
librt.so.1 => /lib64/librt.so.1 (0x0000003b48e00000)
libz.so.1 => /usr/lib64/libz.so.1 (0x0000003b48a00000)
libcares.so.2 => not found
libc.so.6 => /lib64/libc.so.6 (0x0000003b47a00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003b47600000)
[root@nsetcindia-web ~]#
Add your custom lib locations to /etc/ld.so.conf
and do
ldconfig
To see
ldconfig -p | less
Subscribe to:
Comments (Atom)