Monday, November 28, 2016

Test TCP and UDP with Netcap

Testing TCP connection Create TCP listener: $ nc -l 9999 Create TCP Client: $ nc -vt 192.168.5.12 9999 Ncat: Version 6.40 ( http://nmap.org/ncat ) Ncat: Connected to 192.168.5.12:9999. Testing UDP connection Create UDP listener: $ nc -ul 9999 Create UDP Client: $ nc -vu 192.168.5.12 9999 Ncat: Version 6.40 ( http://nmap.org/ncat ) Ncat: Connected to 192.168.5.12:9999. Test UDP Connection...

Friday, November 4, 2016

Thursday, November 3, 2016

sysctl to change kernel system settings

To list all settings configurable in the /proc/sys/ directory: /sbin/sysctl -a To assign values to writable files in the /proc/sys/ directory: sysctl -w [parameter] = [value] Example: sysctl -w kernel.sysrq="1" This only works for testing purposes. Special settings within /proc/sys/ are lost when the machine is rebooted. To preserve custom settings, add them to the /etc/sysctl.conf...

Thursday, October 27, 2016

List the contents of a compressed file without extracting all the files

tar file: $ tar -tvf file.tar.gz tar.gz file: $ tar -ztvf file.tar.gz tar.bz2 file $ tar -jtvf file.tar.bz2 List only specific files: $ tar -tvf file.tar 'pattern' Where, t: List the contents. f: process the following file name. v: show detailed information. z: process tar.gz files. j: process tar.bz2 files....

Wednesday, October 26, 2016

Saturday, October 22, 2016

Wednesday, September 21, 2016

Sunday, September 11, 2016

My CLI CheatSheet

Shorcuts Ctrl + W - Erase one word in the current line. !! - Repeats the last command. Ctrl + Z - Stops the current command, Ctrl + D - Log out of current session, similar to exit. Ctrl + K - Deletes from the cursor to the end of the line. Ctrl + R - Type to bring up a recent command. Ctrl + U - Deletes from the cursor back to the line start. ...

Wednesday, August 24, 2016

Edit command from the history list with vi or emacs using fc

fc command is used to edit, re-execute and list previously entered commands from the history list. With fc you can made a quick open of your favorite editor and edit a previously entered command. If the command you want to edit just has been resently executed just type: fc This open the default editor with the command to edit inside. Execute with the option -e to choose the editor you want....

Friday, August 12, 2016

Thursday, July 7, 2016

Screen command quick start guide

To create a new session, write the following with your session name instead of [session]: screen -R [session] This will start a new session with name [session](if not created before) in a new clean "screen". To dettach the session just press: Ctrl + a  (realease keys) d To attach the screen session again, write again: screen -R [session] To list all the screen sessions: screen...

Tuesday, July 5, 2016

Command line history

The history command can be used to list all the previous commands you have typed before. The syntax is as following: history n where n is the number of commands you have typed before. Example: This lists the last 5 commands typed before: $ history 5 510 cp /home/pepito/myfile /home/pepito/myfolder 511 ls 512 ip addr show 513 ifconfig 514 history 5 You can select to execute a command...

Shortcuts to cut, copy & paste on a terminal command line

Ctrl + u : Deletes from the cursor back to the line start. . Ctrl + k : Deletes from the cursor to the end of the line. Ctrl + w : Deletes until after the previous word boundary. Alt + d : Deletes until before the next word boundary. Ctrl + y : Yank/Past the previous killed text at he cursor position. Alt + y :...

Compress and Extract gz, .tar.gz, and .zip

Compress and Extract gz, .tar.gz, and .zip .tar.gz: Compress: tar -czvf file.tar.gz folder/to/compress/ Extract: tar -xzvf file.tar.gz .tar: Compress: tar -cvf file.tar folder/to/compress/ Extract: tar -xvf file.tar .gz: Compress: gzip -9 file Extract: gzip -d file.gz .zip: Compress: zip file.zip folder/to/compress/ Extract: unzip file.z...

Monday, July 4, 2016

SIOCDELRT error when try to delete a single route from route table

If you want to delete a single route from the route table, you have to specify enough parameters to make this route unique. For example, this gives you an error, because the mask is not specified: $ sudo route del -net 192.168.5.0 SIOCDELRT: No such process This gives you a successful output, because the mask is properly specified: $ sudo route del -net 192.168.5.0/24 ...

Friday, July 1, 2016

Tuesday, June 28, 2016

Git - Get new recently added files but yet not commited

The following command gets all the files that you recently added but not commited yet: $ git diff --cached --name-only --diff-filter=A Details: --name-only: shows all the files you changed relative to HEAD. --name-status: to get the status symbol too. --diff-filter=A: shows only the new recently added fil...

Monday, June 27, 2016

Erase all files/directories except some of them

To erase all directories except one, execute the following: $ find . -maxdepth 1 -not -name [file/directory_name] -exec rm -R {} \; Where: -maxdepth: prevents to erase recursively inside the directory to keep. If you want to be sure that the correct files will be removed, run first the beginning part of the command(before "-exec") and when you are sure, execute the complete command: $ find ....

Shortcuts to move the cursor on a terminal command line

Ctrl + a : Moves the cursor to the line start. . Ctrl + e : Moves the cursor to the line end (remember e for end). Alt + f : Moves the cursor forward one word (remember f for forward) . Alt + b : Moves the cursor backward one word (remember b for backward) . Ctrl + x + x: Moves the cursor to the line start and to the end...

Friday, June 24, 2016

Thursday, June 23, 2016

Git - Checking changes on origin repository against your local

Make a fetch to update the remote branch latest version status in your repository: $ git fetch origin [Your remote branch] fetch does not change anything in your local repository, only updates the information against the branch selected. Check differences with diff: $ git diff origin/[Your remote branch...

Wednesday, June 22, 2016

Git - Commit project to new branch

Create a new branch and move your project to it: $ git checkout -b [New Branch] If you have modified or created files, add them to the project: $ git add [Your modified or new files] Commit your changes: $ git commit -m '[Your Comments]' Push the project to the new branch: $ git push origin [New Branch] See also: https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merg...

Monday, June 13, 2016

Friday, June 10, 2016

Install Sublime Text 3

Download Sublime Text 3: wget https://download.sublimetext.com/sublime_text_3_build_3114_x64.tar.bz2 Uncompress tarball: sudo tar vxjf sublime_text_3_build_3114_x64.tar.bz2 Move sublime directory to /opt: sudo mv sublime_text_3 /opt/ Create symbolic link to sublime: sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime Execute sublime and enjoy!: subl...

Thursday, June 9, 2016

Git - Steps to commit a project

1. Show the status(how many new files, deleted files, modified files, etc.): $ git status 2. Add all files to the project: $ git add -A the -A option means track all including deleted files. 3. Commit: $ git commit -m "[Comments]" the -m option gives you the possibility to add your comments in the same line. 4. Push: $ git push -u origin master The -u is optional and what it does is sets your...

Thursday, May 19, 2016

Copy command output data to standard output and to a file

Use the tee command:   $ [COMMAND] | tee [OUTPUT.FILE]   Where:   [COMMAND] is the command you want to execute. [OUTPUT.FILE] is the file you want to write in.     Variation for writing the standard error output:   $ [COMMAND] 2>&1 | tee [OUTPUT.FILE]   Where:   [COMMAND] is the command you want to execute.  [OUTPUT.FILE] is the file you want to...

Monday, May 9, 2016

Wednesday, March 30, 2016

Configure password-based login for root

By default, the SSH server denies password-based login for root. In /etc/ssh/sshd_config, change: PermitRootLogin without-password to PermitRootLogin yes And restart SSH: sudo service ssh restart Or, you can use SSH keys. If you don't have one, create one using ssh-keygen (stick to the default for the key, and skip the password if you feel like it). Then do sudo -s (or whatever your...

Tuesday, March 29, 2016

Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

Blog Archive

Search This Blog

Powered by Blogger.