Write the web service's response(xml, json, plain text) in a file, and then run the following in a terminal:
$ while true; do echo -e "HTTP/1.1 200 OK\r\n\r\n$(cat wsresponse.file)" | nc -l 9999; done
Where wsresponse.file is the file with the web service response.
In this case, the web service mock is listening in the port 9999. Just change the port as your needs...
Friday, December 1, 2017
Tuesday, August 29, 2017
Tcpdump Packet Capture Truncated
Older versions of tcpdump truncate packets to 68 or 96 bytes. To solve this, use -s 65535 to capture full-sized packet:
$ tcpdump -i [interface] -s 65535 -w [file]...
Thursday, March 9, 2017
Find text inside compressed files

Designed by Freepik
You have a group of files and some of them are compressed with zip or gz and you want to search for a specific text in each of them. To do this, you can use the following command:
find -name [FILE_PATTERN] -print0 | xargs -0 zgrep "[TEXT_TO_FIND]"
Where:
[FILE_PATTERN] : is...
Tuesday, March 7, 2017
Copy directories with scp
scp -rp [directory_to_copy] [user]@[host]:[path]
Where:
[directory_to_copy]: directory to be copied
[user]: destination host user
[host]: destination host
[path]: destination path
-r: recursive, copy all directory content.
-p: preserves modification times, access times, and modes from the original fi...
Wednesday, February 1, 2017
reboot vs shutdown -r now
Generally shutdown -r now is safer.
In most of the unix distributions they perform exactly the same actions except for Mac OSX. On Mac OSX reboot performs an instant reboot. There is no unmounting and no syncing. So, to avoid headaches, play safe and do not use reboot.
Syntax of shutdown command:
shutdown [OPTION] [TIME] [MESSAGE]
To reboot the system right now safely write:
shutdown...
Tuesday, January 24, 2017
Tail command with color
tail -f myfile.log | perl -pe 's/.*TEXT_TO_FIND.*/\e[1;31m$&\e[0m/g'
\e[1;31m will give you the red color. If you would like some yellow, use \e[1;33m, and for green use \e[1;32m. The \e[0m restores the normal text color.
SOURCE: http://unix.stackexchange.com/questions/8414/how-to-have-tail-f-show-colored-output
(Answer <37>)
...
Popular Posts
-
The man page says: EINVAL A new segment was to be created and size < SHMMIN or size > SHMMAX, or no new segment was to be created, ...
-
To swap column 2 and 3 in a 4 column file: awk -F, '{print $1,$3,$2,$4}' OFS=; " FILE " > NEW_FILE where: OFS: ind...
-
Write the web service's response(xml, json, plain text) in a file, and then run the following in a terminal: $ while true; do echo -e...
-
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, t...
-
ENOSPC returns from msgget indicates that the system-wide maximum number of message queues has been reached. Solution: Change this lim...
-
To uninstall driver from unixODBC using odbcinst, execute: $ sudo odbcinst -u -d -n [ Driver_name ] FreeTDS has been deleted (if it existed...
-
Designed by Freepik You have a group of files and some of them are compressed with zip or gz and you want to search for a specific tex...
-
Shorcuts Ctrl + W - Erase one word in the current line. !! - Repeats the last command. Ctrl + Z - Stops the current command, Ctr...
-
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 ...
-
To erase files older than 24 hours ago: find . -mmin +1440 -exec rm -fr {} \ 24 hours = 24 * 60 minutes = 1440 minutes
Recent Posts
Categories
.bash
.bashrc
action
awk
bash
branch
changes
chmod
chown
color
column
command line
commands
commit
compress
compress files
compressed
config
console
convert
copy
CR-LF
create
cut
delete
desktop
diff
directories
directory
dos
driver
erase
error
etc
except
exclude
extract files
fetch
find
format
git
gnome
gz
hash
hostname
init.d
install
integrity
ipc
kernel
linux
list
ls
md5
mock
msgget
mysql
netcat
networking
newlines
odbc
odbcinst
openvpn
owner
passwd
paste
permissions
queue
quick guide
rc.d
readline
reboot
recursively
redhat
release
remove
rm
route
routing
scp
screen
script
selinux
shell
shmget
shortcuts
shutdown
SIOCDELRT
start
stderr
stdout
sublime text
sublime text 3
swap
sysctl
tail
tar
tar.gz
tcp
tcpdump
tee
terminal
test
truncate
udp
uname
uninstall
unixODBC
user
useradd
version
view
vpn
webservice
zgrep
zip
Unordered List
Text Widget
Pages
About Me
Search This Blog
Powered by Blogger.