Quite simple to do if I only remember the command.
find -name *partoffilename* |
Will search from the current directory or a directory can be specified
find /the/path/ -name *partoffilename* |
Quite simple to do if I only remember the command.
find -name *partoffilename* |
Will search from the current directory or a directory can be specified
find /the/path/ -name *partoffilename* |
To add a existing user to a group
usermod -a -G thegroup theuser |
To add a user to a group when the user is created
useradd -G thegroup theuser |
Finding the serial number of a hard drive on a Linux console (as root) is simple with the right tool.
The right tool in this case is hdparm (using the -i option).
-i will query the device directly for the details.
Example:
themachine:/proc# hdparm -i /dev/sda /dev/sda: Model=ST31500341AS , FwRev=CC1H , SerialNo= 9VS21ZXM Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4 BuffType=unknown, BuffSize=0kB, MaxMultSect=16, MultSect=?16? CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=18446744072344861488 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120} PIO modes: pio0 pio1 pio2 pio3 pio4 DMA modes: mdma0 mdma1 mdma2 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 AdvancedPM=no WriteCache=enabled Drive conforms to: unknown: ATA/ATAPI-4,5,6,7 * signifies the current active mode |
Using the option -I instead gives even more information:
themachine:/proc# hdparm -I /dev/sda /dev/sda: ATA device, with non-removable media Model Number: ST31500341AS Serial Number: 9VS21ZXM Firmware Revision: CC1H Transport: Serial Standards: Used: unknown (minor revision code 0x0029) Supported: 8 7 6 5 Likely used: 8 Configuration: Logical max current cylinders 16383 16383 heads 16 16 sectors/track 63 63 -- CHS current addressable sectors: 16514064 LBA user addressable sectors: 268435455 LBA48 user addressable sectors: 2930277168 device size with M = 1024*1024: 1430799 MBytes device size with M = 1000*1000: 1500301 MBytes (1500 GB) Capabilities: LBA, IORDY(can be disabled) Queue depth: 32 Standby timer values: spec'd by Standard, no device specific minimum R/W multiple sector transfer: Max = 16 Current = ? Recommended acoustic management value: 254, current value: 0 DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 Cycle time: min=120ns recommended=120ns PIO: pio0 pio1 pio2 pio3 pio4 Cycle time: no flow control=120ns IORDY flow control=120ns Commands/features: Enabled Supported: * SMART feature set Security Mode feature set * Power Management feature set * Write cache * Look-ahead * Host Protected Area feature set * WRITE_BUFFER command * READ_BUFFER command * DOWNLOAD_MICROCODE SET_MAX security extension * Automatic Acoustic Management feature set * 48-bit Address feature set * Device Configuration Overlay feature set * Mandatory FLUSH_CACHE * FLUSH_CACHE_EXT * SMART error logging * SMART self-test * General Purpose Logging feature set * WRITE_{DMA|MULTIPLE}_FUA_EXT * 64-bit World wide name Write-Read-Verify feature set * WRITE_UNCORRECTABLE_EXT command * {READ,WRITE}_DMA_EXT_GPL commands * Segmented DOWNLOAD_MICROCODE * SATA-I signaling speed (1.5Gb/s) * SATA-II signaling speed (3.0Gb/s) * Native Command Queueing (NCQ) * Phy event counters Device-initiated interface power management * Software settings preservation * SMART Command Transport (SCT) feature set * SCT Long Sector Access (AC1) * SCT LBA Segment Access (AC2) * SCT Error Recovery Control (AC3) * SCT Features Control (AC4) * SCT Data Tables (AC5) unknown 206[12] (vendor specific) Security: Master password revision code = 65534 supported not enabled not locked not frozen not expired: security count supported: enhanced erase 240min for SECURITY ERASE UNIT. 240min for ENHANCED SECURITY ERASE UNIT. Logical Unit WWN Device Identifier: 5000c50014ec1f60 NAA : 5 IEEE OUI : c50 Unique ID : 014ec1f60 Checksum: correct |
If using sudo gives the error message “unable to resolve host hostname” then one solution is to add the hostname in /etc/hosts
127.0.0.1 hostname.domain.com hostname localhost |
Sometimes you wish to make fsck run at the next time (after the computer is powered up/rebooted).
This can be achieved by
By passing the option “F” to shutdown it will force a file system check at the next boot up.
shutdown -rF now |
If the file “/forcefsck” exists then a fsck is forced at boot up.
touch /forcefsck |
A Linux machine will auto check the file system if the last shutdown was unclean (the system was powered off before the file system was unmounted) or if it has passed to much time since the last check.
This can be turned off in a few ways, here are some.
If the sixth option is not 0 (or missing) then fsck will do automatic checking, so change the sixth option to a 0.
As root edit the /etc/fstab (use your favorite text editor or vi).
/dev/sda1 /home/files ext3 defaults 0 0 |
It is possible to pass the option fastboot to the kernel at boot time, this will also prevent fsck from running at boot time.
Edit /boot/grub/menu.lst (use your favorite text editor or vi) [might also be called /etc/grub.conf]
So an example of this would look like
title Debian GNU/Linux, kernel 2.6.26-1-686 root (hd0,0) kernel /vmlinuz-2.6.26-1-686 root=/dev/mapper/root-root--volume ro fastboot initrd /initrd.img-2.6.26-1-686 |
If you only wish to bypass the automatic testing of the file system once, but keep the automatic settings saved you can use the shutdown command with the option “f”.
For instance to reboot without checking
shutdown -rf now |