if you need to change your previous directory rapidly you can add – (dash) to your cd command and no more arguments.
if you were in:
and now in:
you can easily go back to /etc/apt/sources.list.d/ with the command
You’ve downloaded Ubuntu ISO from a mirror and want to test or install it to your computer. There are many ways to do this but I’ll share my method which requires no additional tools or software in this post. Additionally you can use this method in order to create bootable USBs for other ISOs if your ISO is hybrid image.
Unlike other methods my method does not require other tools or software to create that bootable USB, in fact it only uses dd command that is standard in Linux.
After 12.04 (I guess) all Ubuntu ISOs are hybrid ISO. This means when you dd the ISO directly to USB device then your USB will be bootable already. That’s that much easy.
But there is an important point in that process. dd command may be destructive if your destination device is not correct. So to ensure the device you double check your destination with the commands:
whichever gives you the precise information that you make sure it is the correct device.
After this short information I’ll give command to create (prepare) bootable USB below:
dd if=<iso-file> of=<destination-device> oflag=direct bs=8M
in that command if is the hybrid iso (remember your ISO files are already hybrid for the releases after 12.04).
of is the output device. Note that it is the device not the partition. For example it will be: /dev/sdb is an device and if it is your destination device it is a valid entry. But /dev/sdb1 is a partition and even /dev/sdb is your destination device giving /dev/sdb1 for of parameter will not create a bootable USB because /dev/sdb1 is a partition. So this parameter has to be device not partition.
oflag ensures caching of block device is turned of while executing dd.
bs is the block size and 8M is a fairly good parameter for the command.
For an example, if your device is /dev/sdb and you’re creating a bootable USB from ubuntu-16.04.1-desktop-amd64.iso then your command would be:
dd if=ubuntu-16.04.1-desktop-amd64.iso of=/dev/sdb oflag=direct bs=8M
Note that you may need to use sudo with that command.
If you do not have screen off function keys in your keyboard then you can use following commands to turn your screen off.
First you need to find out your screen identifier:
$ xrandr --listmonitors
0: +*LVDS1 1600/310x900/174+0+0 LVDS1
Then turn screen off with the following cmd:
xrandr --output LVDS1 --off
This will totally turn your screen off.
Today I’d like to give codes and solution to reverse a singly linked list in a single pass and not using superfluous storage.
Off course there is a solution if you duplicate list, put all values into a vector or array, and other not efficient ways to accomplish this task. Recursive solutions could also be proposed. But iterative solution is the best way to solve this problem. Because if you use recursive method, there will be superfluous, and not necessary method calls and extra stack storage will be used for each local variables, and it won’t be best shot because if number of nodes in linked list is too much then you’ll probably exhaust your stack memory.
This is a puzzle like problem for linked lists. We’ll use similar solution for our code in Finding The Half Of Linked List in Single Traversal. But we’ll add some spice to the code in order to convert solution to be applied to this problem.
Ok let’s have a look to our proposed solution. Continue reading
You know how to install deb packages with apt-get cmd. But sometimes you need to find the package provides a specific file or executable.
RedHat or CentOS users have this command by default via yum cmd.
yum whatprovides updatedb
This command outputs all packages provide updatedb file (in that case it is an executable). Continue reading
Recently I’ve developed a brute force password cracker tool (can be found in post BruteForcer). I think it deserves to mention some design characteristics of the application. I’ll mention Alphabet Generation in other words base 26 operations that is used and needed for many programmers.
Alphabet to Generate
Our generator should output strings based on the alphabet that we provide. For instance if our alphabet was:
Alphabet = “ABC” Continue reading
I’m very forgetful these days. Even though I could not remember what I ate yesterday or what I wore, I have password protected everything. As a result, most of the times I have ended up with a locked zip, tar.gz or other file. Yesterday I had same experience and I decided to write a brute force python application to crack my password protected file.
Unfortunately I knew that it would take time for the app to crack with brute force technique, but I could use some tricks to improve performance. For instance I can limit the alphabet to attack (most of you use same pattern, special characters, password scheme for encryption) which would save time significantly.
Today I’d like to mention about search engines and their design criterias. Yes we have Google, Bing, Yahoo, Duckduckgo, yandex and many more. But is it easy to build a search engine? The answer is clearly NO. If you think that you can easily build a search engine you’re more like you’re comparing a Ferrari and 1769 Cugnot Steam Trolley (Jonathan Holguinisburg). Yes, it is that much different.
I’ll elaborate what I mean. Let’s start with first phase, crawling.
I should mention about a tool that deserves to be described specifically – rsync.
This tool is well known by system administrators but not as much by home users. But this tool has promising capabilities for them as well. If you’re a backup lover like me (your photos, documents and etc.) and if you’re doing a copy&paste for that, rsync is a life saver.
rsync simply synchronizes your destination directory to be same as your source directory. It does this process with very effective way. It calculates differences and only copies/synchronizes the differences of files and related directories. The destination can be a remote machine (i.e. remote_user@remote_ip:/destination/directory/path). So I backup my home folders contents with my external HDD with:
rsync -avz source-dir destination-dir
Do not use copy&paste (including console cp commands) for backup purposes. Use rsync.