Try out lsd instead of ls to list files in a directory. This tool is a rewrite of GNU ls command with many new features such as colors, icons, a tree-view, more formatting options, and so on:
$ sudo apt install lsd
Apart from using lsd, exa is also another cool replacement for the venerable file-listing command-line program ls that comes with Unix and Linux operating systems, adding features and improving defaults. It uses colors to differentiate between file types and metadata.
It is familiar with symlinks, extended attributes, and Git. It's also small, fast, and only has one binary. Exa attempts to be a more feature-rich, user-friendly version of ls by deliberately making some decisions differently.
This program may not be installed on your system, so you must first install it using your system package manager, such as in Ubuntu or Debian run:
$ sudo apt install exa
Follow us (@linuxopsys) for more byte sized Linux tips and be a better informed Linux user 🐧😎
• • •
Missing some Tweet in this thread? You can try to
force a refresh
99.9% of Linux users use the cat command every day.
Despite this, most people do not take advantage of its full potential.
In this thread, I'll explain what the cat command is and show you some options you probably didn't know about (but you should):
The cat command is one of the most commonly used in Linux. The cat command gets its name from its ability to concatenate files. It has the ability to concatenate files, read and write file contents to standard output.
If you do not specify a filename to read from, or if the filename is replaced with a single hyphen (-), the data will be read from standard input (stdin)
You can use the find command's -exec option to call an external program to perform a specific action on the returned files that match specific criteria. For example, deleting files, listing file perms, and so on.
$ find ~/ -type f -exec ls -lah {} +
This is very useful when performing the same action on multiple files in different locations.
The above command is an example of listing the permissions and other metadata of every file that the find command finds.
A breakdown of the -exec option:
• exec ls - this tells find to execute the ls command on every filename that matches the search string.
• -lah - displays all files, including hidden files, their permissions, and other file metadata, such as sizes, in human readable format.
how to use the find command to search for files and directories in Linux:
The Linux find command is a powerful tool that allows system administrators to search for and manage files and directories that match a set of criteria in the filesystem.
You can not only use the find command to search for files on your system, but you can also use external commands to perform actions on those files, such as deleting them with the rm command, checking their permissions with the ls command, copying them with the cp command etc.
20 Lesser known useful Linux commands (with explanation + examples):
1. nl command
The nl command in linux stands for number lines. If you ever had a large text document and needed to add lines to it, the nl command is your best friend.
Rather than going through the time-consuming process of manually numbering each line , you can simply use nl from the command line and be done in a matter of seconds.
Input, Output, and Error Redirection in Linux explained (with examples):
Most Unix/Linux system commands accept input from your terminal and return the resulting output to it.
A command normally reads its input from the standard input, which is usually your terminal.
Similarly, by default, a command writes its output to standard output, which is your terminal.
The concept of redirection refers to the ability to redirect stdin, stdout, and stderr from their usual output locations to another file or command (or even peripheral devices).
12 destructive Linux terminal commands every Linux user must be aware of (don't run these):
1. Recursive deletion 🔁🗑️
This is one of the scariest commands. When you run this command, it deletes everything in the root directory forcibly and recursively. As a result, all of your directories and subdirectories will be deleted, and all of your data will be lost.
2. Implode hard drive 🕳️
This command will move all data to a special location in Linux known as the black hole, which is located in your system at /dev/null.