The linux Command Y
The linux command y allows you to send an affirmative response to commands that would otherwise request a user-confirmation prompt. This is particularly useful when piping a command to other commands that will run non-interactively.
Whether you’re an experienced Windows system administrator looking to expand your skills, or you’ve just switched to Linux from a different operating system, these 10 basic Linux commands will help you get started.
Linux is the most popular operating system for developers. It is free and has better security than its competitors. It also has a more powerful command line.
The apt command is a tool that allows you to automate the process of installing software packages. It sends responses to the questions that a script or binary would ask and proceeds with the process based on your answers.
Many Linux commands have options that you can use to modify their behaviour. These options are usually denoted by a – and followed by a letter.
Most Linux commands will display prompts to ask for input or warn you of errors. However, you can use the force option to ignore these messages.
The ls command shows the contents of your working directory. Adding the -h option changes the output to human-readable format.
The r command shows the contents of the current working directory. Depending on the shell configuration, the output is color coded. Those entries that are plain text files or directories appear in red, those that are symbolic links in blue and those that are executables in green.
If r is piped to commands that request user confirmation, it will answer “yes” automatically. This is useful for commands that would otherwise require you to manually respond to each prompt.
The s command searches for matching patterns and then replaces them. s also has subcommands that modify the search or replacement process.
The cd command is an important Linux command to know as it allows you to move between directories within your system. This is particularly useful when creating scripts. It is also a great way to check the current directory you are in.
Using the apt command lets you install software on your Linux system. The system creates a list of available packages and where they can be found on the internet.
The yes command was built to send answers to a script or binary, which then can run non-interactively. It is limited to one response per question, though. The “>” and “>>” are output redirection operators in Linux.
Adding the -v option to command makes bash skip its normal function lookup for both builtins and your $PATH. It excludes aliases and other variables too, so it’s a useful way to avoid errors.
The which command shows the location of all matching commands on a system, including those that are symlinks. The command excludes shell built-in utilities from its output, so it’s a great tool for detecting duplicate programs.
w is a command that shows information about users logged in to the system and what they are doing. It combines the functionality of three other Unix commands: uptime, who and ps -a.
w’s output includes eight columns: USER, TTY, FROM, LOGIN@, IDLE, JCPU and PCPU. You can use a number of options to modify the command’s behavior or output. For example, -s produces short-form output by omitting columns like FROM.
The x command prints hardware registers in the Linux kernel. It is a useful tool for troubleshooting and development.
The yes command is a simple tool that will repeat any string you give it. It is often used in scripts to avoid having to answer a lot of questions.
Other useful commands include pwd, which displays the current working directory, and ls, which lists all files in the current directory. Many of these commands have multiple options, so be sure to check out their manuals.
z is a utility that maintains a jump-list of your most frequent directories. It uses a heuristic that combines frequency and recentness to determine a rank.
Ctrl+Z suspends a command or program and puts it on hold, reducing its RAM and CPU consumption until you re-run it.
AWK is a powerful text-processing tool that dates back to Unix days before Perl or Python came into existence.
Each file (and directory, which Unix treats as files) on a Linux system is associated with records indicating who has permission to read it or write it. These are broken down into three categories: owner, group and other.
The cat command displays the contents of a text file without pausing. It can be used to quickly read brief files or to concatenate multiple text files.