5w33t45 Archive
whereis command
January 17, 2021
No Comments
The whereis command in Linux is used to locate the binary, source, and manual page files for a command. This command searches for files in a restricted set of locations (binary file directories, man page directories, and library directories). It is usually used to find executables of a program, its man pages and configuration files. The syntax of the command
Determine file type in Linux or Mac OS X
January 17, 2021
No Comments
To determine the file type in Linux, we can use the file command. This command runs three sets of tests: the filesystem test, magic number test, and language test. The first test that succeeds causes the file type to be printed. For example, if a file is a text file, it will be recognized as ASCII text. Here are a couple of
Count lines in a file
January 17, 2021
No Comments
wc (short for word count) is a command in Linux that displays a count of lines (newline characters, to be precise), words, and bytes for each file you specify. The program prints these three numbers for each file you specify. For example, to find out how many lines, words and bytes random-text.txt has, we can use the following command:
Sort lines of a text file
January 16, 2021
No Comments
The sort command is used to sort the lines of a text file in Linux. You can provide several command line options for sorting data in a text file. Here is an example file: To sort the file in alphabetical order, we can use the sort command without any options: To sort in reverse, we can use the -r option: To
How to make a contact group on an iPhone
January 16, 2021
No Comments
If you’re trying to arrange a party or group trip, texting each person individually can be seriously time-consuming and iOS doesn’t offer an easy way to make a contact group on an iPhone. Luckily, creating contact groups the way Apple intended is as easy as pie with iCloud. There are also a handful of free apps available
How to get a new line character or \n using Java?
November 9, 2020
No Comments
Java has standard way to get line separator regarding platform which executes Java code. It is called System.lineSeparator() .
How to check OpenSSH version on Linux?
November 2, 2020
No Comments
Using Linux – let’s open terminal and enter ssh -v localhost or ssh -V to check the OpenSSH version which is currently installed. __________________________________________________________ $ ssh -v localhost OpenSSH_7.9p1, LibreSSL 2.7.3 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug1: Connecting to localhost port 22. ssh: connect to host localhost port 22: Connection refused
How to create an Array List with Java?
August 14, 2019
No Comments
To store dynamically-sized elements in Java, we used ArrayList. Whenever new elements are added to it, its increase their size automatically. Key Points of an ArrayList An ArrayList is a re-sizable array, also known as a dynamic array. It raises its size according to new elements and decreases the size when the elements are removed.
How to return lambda using Java 8?
July 20, 2018
No Comments
The first thing, which I am going to show you – how you can easily return lambda as a return type. This is example is very simple and you could adjust it regarding your needs with your domain objects, etc. We are using java.util.function.Function<T, R> interface to return function from our method. T – means
How to list stopped docker containers?
July 10, 2018
No Comments
If we want to see, which docker containers are stopped or we need to find ID of container, which we want to start, we could do that: docker ps --filter "status=exited" or docker ps -f "status=exited"