All Go Rust Python PHP JavaScript
Chrome Dev Summit to secure your spot in workshops, office hours and learning lounges!

How to Check if a File is a Valid Image in Go

In Golang, there are 2 ways to check if a file is a valid image. Using DetectContentType Function The http.DetectContentType() function implements the algorithm described at https://mimesniff.spec.whatwg.org/ to determine the Content-Type of the gi...
pooriabt

How to get content from a url in Go

Reading from a url resource in Go.Fetching a URL Go provides a collection of packages, grouped under net, that make it easy to send and receive information through the Internet. Package http provides HTTP client and server implementations. packag...
Patcher56

How to use the telnet command in Linux

user interface to the TELNET protocol. Telnet is an application protocol used on the Internet or local area network to provide a bidirectional interactive text-oriented communication facility using a virtual terminal connection. User data is interspe...

How to use the mkdir command in Linux

Create the DIRECTORY(ies), if they do not already exist. mkdir command in Linux allows the user to create directories (also referred to as folders in some operating systems ). This command can create multiple directories at once as well as set the p...

How to use the history command in Linux

history command is used to view the previously executed command. The history command works with the command history list. When the command is issued with no options, it prints the history list. The History library provides a history expansion featur...

How to use the kill command in Linux

terminate a process. kill is a command that is used in several popular operating systems to send signals to running processes. The command kill sends the specified signal to the specified process or process group. If no signal is specified, the TE...

How to use the head command in Linux

Print the first 10 lines of each FILE to standard output. head is a program on Unix and Unix-like operating systems used to display the beginning of a text file or piped data. By default, head will print the first 10 lines of its input to the stand...

How to use the gzip command in Linux

Compress or uncompress FILEs. Gzip reduces the size of the named files using Lempel-Ziv coding (LZ77). Whenever possible, each file is replaced by one with the extension .gz, while keeping the same ownership modes, access and modi‐ficati...

How to use the grep command in Linux

Search for PATTERN in each FILE or standard input. grep is a command-line utility for searching plain-text data sets for lines that match a regular expression. Its name comes from the ed command g/re/p (globally search for a regular expression and p...

How to use the free command in Linux

Display amount of free and used memory in the system. free displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. The information is gathered by parsing /proc/meminfo....

How to use the find command in Linux

search for files and directories based on their permissions, type, date, ownership, size, and more. find is a command-line utility that locates files based on some user-specified criteria and either prints the pathname of each matched object or, if ...

How to use the diff command in Linux

Compare FILES line by line. You can use the diff command to show differences between two files, or each corresponding file in two directories. diff outputs differences between files line by line in any of several formats, selectable by command line o...

How to use the df command in Linux

Show information about the file system on which each FILE resides, or all file systems by default. df (abbreviation for disk free) is a standard Unix command used to display the amount of available disk space for file systems on which the invoking us...

How to use the curl command in Linux

command line tool and library for transferring data with URLs. cURL (pronounced 'curl') is a computer software project providing a library (libcurl) and command-line tool (curl) for transferring data using various network protocols. The name ...

How to use the chown command in Linux

The chown command changes user ownership of a file, directory, or link in Linux. The command chown, an abbreviation of change owner, is used on Unix and Unix-like operating systems to change the owner of file system files, directories. cha...