FASTBOOT commands don't work at all on my Samsung phone I did every things.
installing all USB driver.
my phone driver.
ADB driver.
enabling USB debugging.
every thing.
but still i have problem with fastboot commands. like if i type : fastboot devices. it tell me waiting for any device . every thing is work perfectly in adb commands like adb devices, but not fastboot. i also installed SDK and google drivers.

I wanna install a custom recovery (twrp) to back up my EFS folder and then root it and then install custom rom :) . but at the first level i got stuck and i cant install the custom recovery. i can do any command like adb reboot download but in downloading mode i cant use fastboot command as fastboot flash recovery. after typing this fastboot command the next line it tells me that "waiting for any device".
The only possible way to backup EFS partition on a non rooted Samsung is using Odin to flash TWRP which corresponds to your device and after that boot to recovery using key combo. Power+Home+Volume^. At recovery access TWRP Terminal. Copy the /factory_init.rc to /sdcard. Copy the file to your desktop and open it with wordpad. It should look something like this:

import /init.environ.rc
import init.fon.rc
import init.trustonic.rc
import init.nvdata.rc
import init.microtrust.rc
import factory_init.usb.rc

on early-init
    # Set init and its forked children's oom_adj.
    write /proc/1/oom_score_adj -1000

    # Set the security context of /adb_keys if present.
    restorecon /adb_keys

    start ueventd

    write /proc/bootprof "INIT: usr/eng build setting"

sysclktz 0

loglevel 5

# Backward compatibility
    symlink /system/etc /etc
    symlink /sys/kernel/debug /d




# Link /vendor to /system/vendor for devices without a vendor partition.
    symlink /system/vendor /vendor

# Create cgroup mount point for cpu accounting
    mkdir /acct
    mount cgroup none /acct cpuacct
    mkdir /acct/uid

    mkdir /system
    mkdir /data 0771 system system
    mkdir /cache 0770 system cache
    mkdir /config 0500 root root

# Mount staging areas for devices managed by vold
    # See storage config details at http://source.android.com/tech/storage/
    mkdir /mnt 0755 root system
    mount tmpfs tmpfs /mnt mode=0755,uid=0,gid=1000
    restorecon_recursive /mnt
    # Support legacy paths
    symlink /sdcard /mnt/sdcard

    mkdir /mnt/secure 0700 root root
    mkdir /mnt/secure/asec 0700 root root
    mkdir /mnt/asec 0755 root system
    mkdir /mnt/obb 0755 root system
    mkdir /mnt/media_rw 0750 root media_rw
    mkdir /mnt/user 0755 root root
    mkdir /mnt/user/0 0755 root root
    mkdir /mnt/expand 0771 system system

    # Storage views to support runtime permissions
    mkdir /storage 0755 root root
    mkdir /mnt/runtime 0700 root root
    mkdir /mnt/runtime/default 0755 root root
    mkdir /mnt/runtime/default/self 0755 root root
    mkdir /mnt/runtime/read 0755 root root
    mkdir /mnt/runtime/read/self 0755 root root
    mkdir /mnt/runtime/write 0755 root root
    mkdir /mnt/runtime/write/self 0755 root root

    # Symlink to keep legacy apps working in multi-user world
    symlink /storage/self/primary /sdcard
    symlink /mnt/user/0/primary /mnt/runtime/default/self/primary

    write /proc/sys/kernel/panic_on_oops 1
    write /proc/sys/kernel/hung_task_timeout_secs 0
    write /proc/cpu/alignment 4
    write /proc/sys/kernel/sched_latency_ns 10000000
    write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
    write /proc/sys/kernel/sched_compat_yield 1
    write /proc/sys/kernel/sched_child_runs_first 0

#INTERNAL_START
# Temp Backward compatibility
    symlink /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/boot /dev/bootimg 
    symlink /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/recovery /dev/recovery
    symlink /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/secro  /dev/sec_ro
    symlink /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/kb /dev/kb
    symlink /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/dkb /dev/dkb 
    symlink /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/seccfg /dev/seccfg
    symlink /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/proinfo /dev/pro_info 
    symlink /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/nvram /dev/nvram   
    symlink /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/para /dev/misc
    symlink /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/logo /dev/logo 
    #create mountpoint for persist partition
    mkdir /persist 0771 system system
#Create nvdata mount point
    mkdir /nvdata 0771 system system
#INTERNAL_END   

    # Healthd can trigger a full boot from charger mode by signaling this
    # property when the power button is held.
    on property:sys.boot_from_charger_mode=1
    class_stop charger
    trigger late-init

    # Load properties from /system/ + /factory after fs mount.
    on load_all_props_action
    load_all_props

    # Mount filesystems and start core system services.
    on late-init
    trigger early-fs
    trigger fs
    trigger post-fs
    trigger post-fs-data

    # Load properties from /system/ + /factory after fs mount. Place
    # this in another action so that the load will be scheduled after the prior
    # issued fs triggers have completed.
    trigger load_all_props_action

    trigger early-boot
    trigger boot

on fs
#INTERNAL_START
    write /proc/bootprof "INIT:Mount_START"
    mount_all /fstab.mt6735
    write /proc/bootprof "INIT:Mount_END"
#INTERNAL_END


Take note of codes at Internal start. The blocks that hold system images. For example mine uses nvram for IMEI but if it could have been a Samsund device the EFS location could be here:

/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/efs


And back to phone's terminal and write:

adb shell
su
dd if /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/efs of /sdcard/efs.img


Here you could have managed to backup the efs at /sdcard. Writing back the efs to phone will be the opposite. 

dd if /sdcard/efs.img of /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/efs


But if it's a rooted device, just download terminal app and run the codes right away:

If it helped just never forget to let me know