CrazyEngineers
  • Abhishek
    Abhishek

    MemberAug 10, 2013

    [Linux] Tips & Tricks.

    This Thread is dedicated for tips & tricks of Linux. Gather up & share some tricks & tips for linux.
    I will roll the dice first.

    Counting The Number Of Files In A Directory :
    - 'cd' to the desire directory
    - Then type :
     echo * | wc -w 
    Check On The Date & time Computer Was Re-booted :
    - go to root & type :
     last reboot 
    - To know date & time system was booted, go to root & type :
     who -b 
    Find Files & Move It With Single Command :
     find Name_Of_Directory -type f -iname "*.pdf" -exec mv {} Location_Where_You_Wanna_Copy \; 
    example :
     find /abc/ebooks -type f -iname "*.pdf" -exec mv {} /xyz/books \; 
    The above example shows that, from directory /abc/ebooks all .pdf extension files will be moved to /xyz/books directory.
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Nayan Goenka

    MemberAug 10, 2013

    I already made a thread regarding a lot of commands. Still if you need to make a complete directory, you can check it out here. It is almost a<a href="https://ss64.com/bash/" target="_blank" rel="nofollow noopener noreferrer">An A-Z Index of the Linux command line - SS64.com</a>.
    Are you sure? This action cannot be undone.
    Cancel
  • Abhishek Rawal

    MemberAug 10, 2013

    Nayan Goenka
    I already made a thread regarding a lot of commands. Still if you need to make a complete directory, you can check it out here. It is almost a<a href="https://ss64.com/bash/" target="_blank" rel="nofollow noopener noreferrer">An A-Z Index of the Linux command line - SS64.com</a>.
    Tips & Tricks != Commands.
    Are you sure? This action cannot be undone.
    Cancel
  • Abhishek Rawal

    MemberAug 10, 2013

    Format Drive From Terminal :

    (We will format USB drive in this)
    - Insert USB drive in USB slot.
    - Open Terminal & type
     df 
    - This will display directory path of various drives. Check image below :

    Screenshot from 2013-08-11 06:56:33

    The highlighted directory i.e /dev/sdc1 is the flash-drive which I wanna format.

    - Unmount the flash drive first by typing :
     sudo umount <path> 
    here in this example it will be something like
     sudo umount /dev/sdc1 
    - Now to format the flash drive to ext4, type :
     sudo mkfs.ext4  -n 'CrazyEngineers' -l /dev/sdc1 
    You can format drive in another formats using : mkfs.ext2, mkfs.ext3, mkfs.ext4, mkfs.vfat, mkfs.msdos, mkfs.minix etc. etc.

    - Type df again to check the result :

    Screenshot from 2013-08-11 07:08:05

    👍
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberAug 13, 2013

    Create a tunnel between server and you localserver to access remote server resources through following command

    ssh -N -L 3336:127.0.0.1:3306 -i <option private KEY> username@servername.com
    
    Above command will simply map you local server port 3336 to 3306 , with this you can access remote Mysql (3306) through local 3336 port
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register