[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

  • Nayan Goenka
    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 aAn A-Z Index of the Linux command line - SS64.com.
  • Abhishek Rawal
    Abhishek Rawal
    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 aAn A-Z Index of the Linux command line - SS64.com.
    Tips & Tricks != Commands.
  • Abhishek Rawal
    Abhishek Rawal
    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  
    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

    👍
  • Manish Goyal
    Manish Goyal
    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 
    Above command will simply map you local server port 3336 to 3306 , with this you can access remote Mysql (3306) through local 3336 port

You are reading an archived discussion.

Related Posts

When I create a program and want it to be executed using threads do I have to create them myself and add their code to my program or will the...
Education alone cant make a life happier .There should be something other than studies to relax your mind.This thread is specially created to show your talent.it may be related to...
Hi, I am nt so strong @ ma basics.what are the prerequisites I must have for ma PG-DESD @ CDAC. Can you suggest some specific areas on which I must...
With the arrival of Lumia 1020, Nokia is trying to define some epicness. I am not much of a Lumia fan but looking at the features, I will just say,...
Hi CEans I am not new to CE I am CSK AUTO but I havent posted my introduction yet so here it is for you. Name:C.Sarath Kumar Branch:Automobile Engineering Location:Neyveli(Cuddalore...