This command will capture a screenshot of the desktop and save it to the home directory.
jason@neo:~$ import -window root "$HOME/$(date '+%y%m%d_%T').png" |
This is how to do this with the scrot utility.
jason@neo:~$ scrot Desktop-%H:%M:%S-%d-%m.jpg |
Characters preceded by a ‘%’ are interpreted by strftime(2). See man strftime for examples. These options may be used to refer to the current date and time. This enables saving a date-stamped screenshot of your desktop.
To take a screenshot of a certain area of your desktop using the MATE desktop, use the Shift-PrintScr shortcut, this opens a dialog allowing you to select a part of your screen to save to the desktop.
Make all of the filenames of files in a folder lowercase.
jason@jason-Lenovo-H50-55:~$ for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done |
Count the lines of code in an open-source project.
Firstly, install the cloc utility.
jason@jason-Lenovo-H50-55:~/Documents/systemd$ sudo apt install cloc |
Then navigate into the directory containing the source code and we can know how much code is actually in this project.
jason@jason-Lenovo-H50-55:~/Documents/systemd$ cloc src 2064 text files. 2050 unique files. 115 files ignored. github.com/AlDanial/cloc v 1.82 T=2.80 s (696.3 files/s, 232571.8 lines/s) -------------------------------------------------------------------------------- Language files blank comment code -------------------------------------------------------------------------------- C 1095 122906 26314 424294 C/C++ Header 783 11560 16773 42285 NAnt script 35 558 0 4007 m4 4 28 0 609 HTML 1 87 3 457 Bourne Again Shell 4 51 31 282 Bourne Shell 12 63 15 273 Python 5 47 45 197 awk 9 0 0 93 sed 1 0 0 1 -------------------------------------------------------------------------------- SUM: 1949 135300 43181 472498 -------------------------------------------------------------------------------- |
This is very useful for a curious Linux user or someone who is running an open-source project and wants to know how much code is actually in it.
Another very good way to search source trees for certain code.
Install the utility.
┌──[jason@192.168.1.2]─[~/Downloads/NOTREPACKED/nt5src/XPSP1/shell/shell32] └──╼ ╼ $ sudo apt install ack |
Then run it like this to easily search a source tree for certain strings.
┌──[jason@192.168.1.2]─[~/Downloads/NOTREPACKED/nt5src/XPSP1/shell/shell32] └──╼ ╼ $ ack "16bit" menuband/mnstatic.cpp 864: // We only do the banner on 16bit color syreclen.cpp 161: //HACK - Need to simulate a button click on the CPL Dialog. Since it is a 16bit code, we pidl.h 30: WORD wAttrs; // FILE_ATTRIBUTES_* cliped to 16bits control.h 105: HINSTANCE hinst; // either a 16 or 32 bit HINSTANCE (fIs16bit) 117: APPLET_PROC lpfnCPL32; // minst.fIs16bit=FALSE unicpp/dde.cpp 3538: // NB WinFaxPro re-uses the same 16bit selector for all their 3541: // send the 16bit handle through the thunk layer they get a rundlg.cpp 760: BOOL f16bit = FALSE; 771: f16bit = TRUE; 794: f16bit = TRUE; 809: f16bit = TRUE; 815: f16bit = FALSE; 822: f16bit = FALSE; 834: if (f16bit) tngen/jcmarker.cpp 138:/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */ tngen/jchuff.cpp 1888:pcmpgtw mm1, qword ptr [const_255] // split the 16bit value across bit 8 (256) executil.cpp 34:// since many apps use 16bit ddeml windows to communicate with the shell |
This would be another very useful utility for a programmer who has an open-source project to work on and needs to search for certain code.