← Previous | ↑ Home | Next → |
Find last modified files
dk-ls -r -tf -pmtn directory | dk-sort
Find files modified today
dk-ls -r -tf -pmtn directory | dk-lines --today | dk-sort
Find largest files in a directory
dk-ls -r -tf -pstn directory | dk-sort -u
Find largest subdirectories
dk-ls -r -td -pstn directory | dk-sort -u
List files, group by file name suffix, sort each group by file size
dk-ls -tf -psn | dk-sort -u -t -s 1
List files, group by file name suffix, sort each group by modification time
dk-ls -tf -pmn | dk-sort -t -s 2
Convert text file from UTF-8 to UTF-16
To show a file created on Linux on a Windows system:
dk-cat -i utf-8 -o utf16,bom file
Convert text file from WIN1252 or UTF-16 to UTF-8
To show a file created on Windows on a Linux system:
dk-cat -i win1252 -o utf-8 file
The WIN1252 encoding is specified as default encoding used if no BOM is found at the beginning of the file. If the file contains an UTF-16 BOM at start, input encoding is switched to UTF-16.
Show file contents in hexadecimal notation
dk-hex -a -t file
Split overlong lines in mysqldump output
Run 5:
mysqldump … | dk-sqlsplit
Convert image to EPS
Convert image screenshot.png to EPS for use with LaTeX/dvips:
bitmap2pp -l eps screenshot.png
If the PS file from LaTeX/dvips is for printing on a PS language level 2 printer, use:
bitmap2pp -l eps,level=2,lzw screenshot.png
or
bitmap2pp -l eps,level=2 screenshot.png
Convert image to PDF
Convert image screenshot.png to PDF for use with pdfLaTeX:
bitmap2pp -l pdf screenshot.png
Use Fig file with pdfLaTeX
A file named x.fig contains a drawing for use with LaTeX:
Run
fig2lat -l pdf.tex x.fig
to produce the x.tex and x.pdf files.
In your *.tex document use:
\begin{figure}% {\centering% \input{x.tex}\caption{My image}\label{fig:my-image}% }% \end{figure}
Use Fig file with LaTeX/dvips
Run
fig2lat -l eps.tex x.fig
to produce the files x.tex and x.eps.
Use Fig file with both pdfLaTeX and LaTeX/dvips
Run
fig2lat -l pgf x.fig
to produce the x.pgf file.
In your *.tex document use:
\begin{figure}% {\centering% \input{x.pgf}\caption{My image}\label{fig:my-image}% }% \end{figure}
In vim or another vi clone enter the following text:
The test_german_umlauts() function in the
C:\temp\tgu.c file tests german umlauts like
Ä, Ö, Ü, ä, ö, ü, ß.
Now run the
:1,3!dk-t2l
command and see what happens.
Convert text file to full HTML file
Run
dk-t2h -f file
to convert the file into a full HTML file.
Convert text to HTML
Run
dk-t2h file
to obtain a HTML fragment you can insert into a HTML file.
Convert source code to HTML
Run
dk-t2h -l file
to obtain a HTML fragment you can insert as content into a
<pre>...</pre> HTML tag.
As an example we use the following program:
#include <stdio.h>
#include <stdlib.h>
static
void
subroutine(int i)
{
int j;
j = i + 1;
printf("In the sub routine, j = %d\n", j);
}
int main(void)
{
int i;
for (i = 0; i < 10; i++) {
subroutine(i);
}
return EXIT_SUCCESS;
}
We want to inspect function calls and variables.
So we change the source to:
#include <stdio.h>
#include <stdlib.h>
$!trace-include
static
void
subroutine(int i)
{
int j;
$? "+ subroutine %d", i
j = i + 1;
$? ". j = %d", j
printf("In the sub routine, j = %d\n", j);
$? "- subroutine"
}
int main(void)
{
int i;
$!trace-init debtest.deb
$? "+ main"
for (i = 0; i < 10; i++) {
subroutine(i);
}
$? "- main"
$!trace-end
return EXIT_SUCCESS;
}
Run
dkcpre -l debtest.ctr
and build the program. When running the program you will see the regular output produce by the printf function:
In the sub routine, j = 1
In the sub routine, j = 2
In the sub routine, j = 3
In the sub routine, j = 4
In the sub routine, j = 5
In the sub routine, j = 6
In the sub routine, j = 7
In the sub routine, j = 8
In the sub routine, j = 9
In the sub routine, j = 10
Now run
dkcpre -l -d -s debtest.ctr
and build the program.
Now the program produces the regular output and additional debug output from the $!- and $?-instructions:
debtest2.ctr:25: + main
debtest2.ctr:13: + subroutine 0
debtest2.ctr:15: . j = 1
In the sub routine, j = 1
debtest2.ctr:17: - subroutine
debtest2.ctr:13: + subroutine 1
debtest2.ctr:15: . j = 2
In the sub routine, j = 2
debtest2.ctr:17: - subroutine
debtest2.ctr:13: + subroutine 2
debtest2.ctr:15: . j = 3
In the sub routine, j = 3
debtest2.ctr:17: - subroutine
debtest2.ctr:13: + subroutine 3
debtest2.ctr:15: . j = 4
In the sub routine, j = 4
debtest2.ctr:17: - subroutine
debtest2.ctr:13: + subroutine 4
debtest2.ctr:15: . j = 5
In the sub routine, j = 5
debtest2.ctr:17: - subroutine
debtest2.ctr:13: + subroutine 5
debtest2.ctr:15: . j = 6
In the sub routine, j = 6
debtest2.ctr:17: - subroutine
debtest2.ctr:13: + subroutine 6
debtest2.ctr:15: . j = 7
In the sub routine, j = 7
debtest2.ctr:17: - subroutine
debtest2.ctr:13: + subroutine 7
debtest2.ctr:15: . j = 8
In the sub routine, j = 8
debtest2.ctr:17: - subroutine
debtest2.ctr:13: + subroutine 8
debtest2.ctr:15: . j = 9
In the sub routine, j = 9
debtest2.ctr:17: - subroutine
debtest2.ctr:13: + subroutine 9
debtest2.ctr:15: . j = 10
In the sub routine, j = 10
debtest2.ctr:17: - subroutine
debtest2.ctr:29: - main
Run
dkcpre -l -d debtest.ctr
and link against the libdk3trace.so library.
When running the program normal output goes to stdout, debug output goes to the debtest.deb file.
To create a skeleton for a wxWidgets based GUI program using DK tools run:
dkwxwiz testprog TestApp TestFrame
dkcpre -l autoconf ./configure make
to build the program.
On Windows use 6
dkcpre -l nmake -f makefile.vc
instead.
Search the source code for __CHANGE__ markers and apply modifications to the marked places.
Find free user ID (UID)
dk-uid 1500 2000
searches for a free user ID in the range 1500 to 2000.
Create normal user password
8 to 10 characters long, 1 to 3 upper case characters, 1 to 2 digits, 1 to 2 special characters:
dk-pwgen -l 8-10 -u 1-3 -d 1-2 -s 1-2
Create harder password
8 to 10 characters long:
dk-pwgen -h -l 8-10
Create numeric PIN
6 characters long:
dk-pwgen -p -l 6
Create WiFi key
60 positions hexadecimal key:
dk-pwgen -x -l 60
See checksums for a file
wxdkfcs file
Create checksum list on Windows
dk-ls -r -tf -pn directory | dk-fic > checksumlist
Create checksum list on non-Windows system
On a non-Windows system run 3:
find directory -type f | dk-fic > checksumlist
Verify a checksum list
dk-fic -c < checksumlist
Verify a checksum list created on Windows on a non-Windows system
dk-fic -c -i ascii < checksumlist
Verify a checksum list created on Linux on a Windows system
dk-fic -c -i utf-8 < checksumlist
Cloning means transferring the entire contents of a disk or partition to another computer, the destination disk or partition has same size as the original.
On the sender (PC already installed) run 2:
dd if=device | dk-send 9876
On the recipient (new PC to install) run 2:
dk-recv sender-IP 9876 | dk-blks -b 1m | dd of=_device_ bs=1M conv=fdatasync
The 9876 is a TCP port number. Firewall and router ACLs must allow the recipient to connect to this port number on the sender.
Replace device by the device name of the disk or partition to transfer.
See the [dk-send] and [dk-recv] manual pages for more advanced methods: transfer used blocks only, transfer to multiple recipients, compressed and/or encrypted transfer.
One pass
To erase a disk or partition in one pass, run 2:
dk-eradisk -b 1M | dd of=_device_ bs=1M conv=fdatasync
Multiple passes
You can also run multiple passes using different bit patterns 2:
dk-eradisk -p 7 -b 1M | dd of=_device_ bs=1M conv=fdatasync dk-eradisk -p 6 -b 1M | dd of=_device_ bs=1M conv=fdatasync dk-eradisk -p 5 -b 1M | dd of=_device_ bs=1M conv=fdatasync dk-eradisk -p 4 -b 1M | dd of=_device_ bs=1M conv=fdatasync dk-eradisk -p 3 -b 1M | dd of=_device_ bs=1M conv=fdatasync dk-eradisk -p 2 -b 1M | dd of=_device_ bs=1M conv=fdatasync dk-eradisk -p 1 -b 1M | dd of=_device_ bs=1M conv=fdatasync dk-eradisk -p 0 -b 1M | dd of=_device_ bs=1M conv=fdatasync
The final pass should have pass number 0 to write 0-bytes so the disk is seen as new empty hard disk when attempting to install an OS on it.
Create a desktop icon, use the command
ChangeScreenSize 1920 1080 1200 800
to change between screen sizes 1920x1080 and 1200x800.
A typical use case is remote desktop login or login using a virtual machine viewer. On the host you are sitting you might change the viewer between full screen and smaller window, double clicking the desktop icon the windows resolution follows this size change.
dkwt users -l
dkwt groups -l
dkwt printers -l
A print file is a file generated by the Windows print system if the "Print to file" option is activated.
Send a file to the Windows default printer
winprint -d file
Send a file to a specific Windows printer
winprint -P printer file
To remove all jobs from all local print queues submitted by the current user:
wprclean
This does not delete print jobs already transferred to dedicated print servers or already transferred to printer devices.
Append directory at end of system PATH
dkwt env -s -a PATH directory
Administrative privileges are required to modify the system PATH, execute this command and the following two from a cmd.exe executed "Run as administrator".
Probably you need to reboot the computer.
Insert directory at start of system PATH
dkwt env -s -i PATH directory
Remove directory from system PATH
dkwt env -s -d PATH directory
The following programs were used in the examples above, they are not part of DK tools project.
Program | Description |
---|---|
autoconf1 | The autoconf program is contained in the GNU Autoconf project. |
dd 2 | The dd program is contained in the GNU core utilities. |
find3 | The find program is contained in the GNU findutils. |
make4 | Make programs are available from different source, I suggest to use GNU make. |
mysqldump5 | The mysqldump program is contained in the MariaDB project or in the MySQL software. |
nmake6 | The nmake program is installed together with MS Visual Studio and/or other MS developer tools. |
← Previous | ↑ Home | Next → |