Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Bash Cheet Sheets Share/Save - My123World.Com!

  1. #1
    Security Researcher fb1h2s's Avatar
    Join Date
    Jul 2010
    Location
    India
    Posts
    616
    Blog Entries
    32

    Bash Cheet Sheets

    Rename all files in a directorty:
    All files would be renamed to .jpeg extension.

    Code:
    Ex: rename 's/(.*)/$1.jpeg/' *
    Hacking Is a Matter of Time Knowledge and Patience

  2. #2
    Security Researcher fb1h2s's Avatar
    Join Date
    Jul 2010
    Location
    India
    Posts
    616
    Blog Entries
    32

    bash Find Files containing Strings:

    bash Find Files containing Strings:
    credits :dzone.com

    grep -lir "some text" *
    Hacking Is a Matter of Time Knowledge and Patience

  3. #3
    Security Researcher fb1h2s's Avatar
    Join Date
    Jul 2010
    Location
    India
    Posts
    616
    Blog Entries
    32

    Grep Inverse match [ print not matching results

    Will print all results where some string is not found:

    Code:
    grep -v "some string"
    Hacking Is a Matter of Time Knowledge and Patience

  4. #4
    Ohh my !

    This thread should grow ... I mean really grow.
    Bash magic sometimes can be pretty amazing.
    Kudos fb1h2s !

    -

    Narcissus

  5. #5
    Garage Member
    Join Date
    Aug 2012
    Location
    India
    Posts
    97
    Blog Entries
    1
    Faster listing of files

    Code:
    ls -f
    or
    ls -U
    This is generally faster because using either of the switches ensures the files are not sorted and are listed as stored.

    Note: This can be used with `wc -l` for counting files in a directory. This works faster than typical `ls -l | wc -l`
    Code:
    ls -f | wc -l

    Source: http://www.gnu.org/software/coreutil...ing-the-output
    Anyone who stops learning is old, whether at twenty or eighty. Anyone who
    keeps learning stays young. The greatest thing in life is to keep your mind young.
    - Henry Ford

  6. #6
    Network Security Administrator Hackuin's Avatar
    Join Date
    Apr 2011
    Location
    10011001 10011001
    Posts
    104
    Code:
    ss
    Much faster then usual "netstat"

    And all "ip" commands
    Code:
    ip addr
    ip link
    ip route
    Source: Why ifconfig sucks
    "Free software" is a matter of liberty, not price. To understand the concept, you should think of "free" as in "free speech," not as in "free beer."
    "Microsoft is not the answer. Microsoft is the question. NO (or Linux) is the answer."
    "Ubuntu - Linux For Human Beings."

    Currently reading books:
    Integrating Forensic Investigation Methodology into eDiscovery -- by Colin Chisholm.
    Digital Forensics with Open Source Toolss -- by Cory Altheide && Harlan Carvey.

  7. #7

    Trick to escape commands typed in the terminal to be written in bash_history

    Basically all commands typed on the terminal can we viewed in the bash_history file. When you give space and type the command in the terminal it will not be logged in the history.


    user@localhost:~#[space]shutdown now

  8. #8

    Escaping the bash_history

    Whatever command we type on the terminal is logged in the ~/.bash_history file and can we viewed with the history command. But when you give a space and then type the command, the command will successfully run without being logged in the ~/.bash_history file. bash_history file is an hidden file in the users home directory

    Eg: user@box:~$[space]shutdown now

  9. #9
    ... I am no Expert b0nd.g4h@gmail.com b0nd's Avatar
    Join Date
    Jul 2010
    Location
    irc.freenode.net #g4h
    Posts
    744
    Quote Originally Posted by cipher View Post
    Basically all commands typed on the terminal can we viewed in the bash_history file. When you give space and type the command in the terminal it will not be logged in the history.


    user@localhost:~#[space]shutdown now
    Had discussion on same long time back
    http://www.garage4hackers.com/showthread.php?t=1442
    [*] To follow the path: look to the master, follow the master, walk with the master, see through the master,
    ------> become the master!!! <------
    [*] Everyone has a will to WIN but very few have the will to prepare to WIN
    [*] Invest yourself in everything you do, there's fun in being serious

  10. #10
    Quote Originally Posted by b0nd View Post
    Had discussion on same long time back
    http://www.garage4hackers.com/showthread.php?t=1442
    I read it.. What if same technic is being used by an attacker on a prod server?
    In that case we have to write a keylogger & run as a service.. any other suggestion will be appreciate

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •