New commands that I have used frequently the past month...

On my never ending Linux/Unix/Windows knowledge quest, I have learned a few basic commands that have just been really helpful and that I have used very often in the past month while troubleshooting random problems.

Linux
smbmount - mount smb shares
Been in a few tight squeezes with some data I needed off a machine, but my only available storage option is a NAS.
  • smbmount //ip/share /mnt/mountpoint -o username=domain\\user,password=pass
For me this would look like:
  • smbmount //192.168.1.10/Backup /mnt/nas -o username=user,password=password
df - shows disk info (usage, mount point, free space)
The
-a switch displays all filesystems, the -T switch displays the FS type, and the -h switch displys the results in "human readable" formats (such as MB and GB)
  • df -a -h -T
du - shows size of files and folders
The -c switch gives a total of the size of all files in the directory, the -h switch lists size in a human readable format, and the -s switch outputs only the size of the directory, not the files within (it is pointless to use the -c switch with the -s switch unless you really enjoy doing so. Also without the -s switch, the output will be of every file and folder in a directory, which could be very verbose)
  • du -c -h /mnt/Backup
  • du -h -s /mnt/Backup
Unix/Mac
Here is how to make a release renew script to make quicken things up a bit:
In a terminal window, type:
  • nano /usr/bin/rr
Which will open a blank page called rr. Now add:
  • #!/bin/bash
  • echo "Now releasing your IP"
  • sudo ipconfig set int BOOTP
  • sleep 5
  • echo "Renewing your IP"
  • sudo ipconfig set int DHCP
  • echo "Done!"
Where int is the specified interface. CTRL+O to write the file then CTRL-X to exit.
Now to make the file executable enter:
  • sudo chmod 775 /usr/bin/rr
That is it...now just enter rr to release and renew your ip.

Windows
I have also been using Windows to mount network shares through command prompt.
  • net use
  • net use a-z: \\ip\share /USER:domain\user
  • net use /DELETE a-z:
  • net use /DELETE *
The first command will display all mapped network shares.
The second command will map a share and use the logon credentials of domain\user, and might prompt you for your password (a-z is the drive letter for the share to be mapped to, you must use a drive letter not currently used).
The third command will delete a specified mapped drive (again, you must specify a drive letter for a-z).
The fourth command will delete all mapped drives.


These are all simple commands, but very useful for me day to day.


0 comments: