- Linux switch to command
- 5 Ways to Open a Terminal Console Window Using Ubuntu
- Use these shortcuts to quickly perform common tasks
- Open a Linux Terminal Using Ctrl+Alt+T
- Search Using the Ubuntu Dash
- Navigate the GNOME App Launcher
- Use the Run Command
- Use Ctrl+Alt+A Function Key
- How To Switch Between TTYs Without Using Function Keys In Linux
- Switch Between TTYs In Linux
- 20 Commands for Newbies Who Switched from Windows to Linux
- 1. Command: ls
- 2. Command: lsblk
- 3. Command: md5sum
- 4. Command: dd
- 5. Command: uname
- 6. Command: history
- 7. Command: sudo
- 8. Command: mkdir
- 9. Command: touch
- 10. Command: chmod
- 11. Command: chown
- 12. Command: apt
- 13. Command: tar
- 14. Command: cal
- 15. Command: date
- 16. Command: cat
- 17. Command: cp
- 18. Command: mv
- 19. Command: pwd
- 20. Command: cd
- If You Appreciate What We Do Here On TecMint, You Should Consider:
Linux switch to command
By default, console switching is done using Alt-Fn or Ctrl-Alt-Fn. Under X (or recent versions of dosemu ), only Ctrl-Alt-Fn works. Many keymaps will allow cyclic walks through all allocated consoles using Alt-RightArrow and Alt-LeftArrow.
XFree86 1.3 does not know that Alt is down when you switch to the X window. Thus, you cannot switch immediately to some other VT again but have to release Alt first. In the other direction this should work: the kernel always keeps track of the up/down status of all keys. (As far as possible: on some keyboards some keys do not emit a scancode when pressed (e.g.: the PFn keys of a FOCUS 9000) or released (e.g.: the Pause key of many keyboards).)
XFree86 1.3 saves the fonts loaded in the character ROMs when started, and restores it on a console switch. Thus, the result of setfont on a VT is wiped out when you go to X and back. Using setfont under X will lead to funny results.
One can change VT under program control using the chvt command.
This question still comes up from time to time, but the answer is: you already have enough of them. Since kernel version 1.1.54, there are between 1 and 63 virtual consoles. A new one is created as soon as it is opened. It is removed by the utility deallocvt (but it can be removed only when no processes are associated to it anymore, and no text on it has been selected by programs like selection or gpm ).
For older kernels, change the line
If they do not exist yet, create the tty devices with MAKEDEV or mknod tty N c 4 N where N denotes the tty number. For example,
If you want the new VCs to run getty , add lines in /etc/inittab . (But it is much better to have only two getty ‘s running, and to create more consoles dynamically as the need arises. That way you’ll have more memory when you don’t use all these consoles, and also more consoles, in case you really need them. Edit /etc/inittab and comment out all getty ‘s except for the first two.)
When the consoles are allocated dynamically, it is usually easiest to have only one or two running getty . More are opened by open -l -s bash . Unused consoles (without associated processes) are deallocated using deallocvt (formerly disalloc ). But, you say, I am involved in activities when I suddenly need more consoles, and do not have a bash prompt available to give the open command. Fortunately it is possible to create a new console upon a single keystroke, regardless of what is happening at the current console.
If you have spawn_login from kbd-1.04.tar.gz and you put
What action should be taken upon this Spawn_Console keypress can also be set in /etc/inittab under kbrequest , if you have a recent init . See inittab(5).
(This action can be something entirely different — I just called the key Spawn_Console because that is what I used it for. When used for other purposes it is less confusing to use its synonym KeyboardSignal. For example, some people like to put the lines
You can only login as «root» on terminals listed in /etc/securetty . There exist programs that read terminal settings from files /etc/ttys and /etc/ttytype . If you have such files, and create additional consoles, then it might be a good idea to also add entries for them in these files.
Источник
5 Ways to Open a Terminal Console Window Using Ubuntu
Use these shortcuts to quickly perform common tasks
It’s possible to do most of the things you want to do in Linux without using the Linux terminal. However, there are many good reasons to learn how to use it. The Linux terminal provides access to the Linux commands as well as command-line applications that often provide more features than desktop applications. Another reason to use the terminal is that online help guides that solve problems with a Linux environment contain Linux terminal commands.
People use an array of desktop environments as well as Linux distributions. Hence, the terminal commands are usually the same or are easier to narrow down than writing full graphical instructions for each combination.
When using Ubuntu, it is easier to install software using the command line than it is to use the graphical software tools available. The apt-get command provides access to every package in the Ubuntu repositories, whereas the graphical tool is often lacking.
Open a Linux Terminal Using Ctrl+Alt+T
The easiest way to open a terminal is to use the Ctrl+Alt+T key combination. When you hold these three keys at the same time, a terminal window opens.
Search Using the Ubuntu Dash
If you prefer a graphical approach, select either the Activities launcher in the upper-left corner of the desktop or the Show Applications icon in the lower-left corner.
In the search box, enter term. As you type, the terminal icon appears. You will likely see an option for the default GNOME terminal at the top. Below, other terminal emulators that are available to install are listed.
To use the default one for your system, select the GNOME one at the top. It’s called Terminal.
Navigate the GNOME App Launcher
Another way to open a terminal window is to navigate the GNOME applications menu. Select Show Applications in the lower-left corner of the desktop. Then, select All at the bottom of the screen, if it isn’t highlighted, scroll down, and select Utilities.
There are several system tools under Utilities. The Terminal is one of those utilities. Select it to open it.
Use the Run Command
Another relatively quick way to open a terminal is to use the run command option. To open the run command window, press Alt+F2. To open the terminal, type gnome-terminal into the command window, then press Enter on the keyboard.
You must enter gnome-terminal because that is the full name of the terminal application.
You can also type xterm for the xterm application or uxterm for the uxterm application if those are installed on your system.
Use Ctrl+Alt+A Function Key
The methods illustrated so far open a terminal emulator in the graphical environment. To switch to a terminal that isn’t linked to the current graphical session, usually when installing certain graphics drivers or doing anything that messes with your graphical setup, press Ctrl+Alt+F3.
You will need to log in because you are starting a new session.
You can use F4 through F10 to create more sessions.
To get back to the graphical desktop, press Ctrl+Alt+F2.
Источник
How To Switch Between TTYs Without Using Function Keys In Linux
This brief guide describes what is TTY and how to switch between TTYs without using function keys in Linux operating systems.
As mentioned in an answer in AskUbuntu forum, the word TTY came from TeleTYpewriter. Back in the early days of Unix, the user terminals connected to computers were electromechanical teleprinters or teletypewriters( tty in short).
Since then, the name TTY has continued to be used for text-only consoles. Nowadays, all text consoles represents virtual consoles, not physical consoles. The TTY command prints the file name of the terminal connected to standard input.
Switch Between TTYs In Linux
By default, there are 7 ttys in Linux. They are known as tty1, tty2. tty7. The 1 to 6 ttys are command line only. The 7th tty is GUI (your X desktop session).
You can switch between different TTYs by using CTRL+ALT+Fn keys. For example to switch to tty1, we type CTRL+ALT+F1 .
This is how tty1 looks in Ubuntu 18.04 LTS server.
If your system has no X session, just type Alt+Fn key. You don’t need to use CTRL .
In some Linux editions (Eg. from Ubuntu 17.10 onwards), the login screen now uses virtual console 1. So, you need to press CTRL+ALT+F3 up to CTRL+ALT+F6 for accessing the virtual consoles.
To go back to desktop environment, press CTRL+ALT+F2 or CTRL+ALT+F7 on Ubuntu 17.10 and later.
You know now we can easily switch between TTYs using CTRL+ALT+Function_Key(F1-F7). However, if you don’t want to use the functions keys for any reason, there is a simple command named «chvt» in Linux.
The «chvt N» command allows you to switch to foreground terminal N , the same as pressing CTRL+ALT+Fn . The corresponding screen is created if it did not exist yet.
Let us see print the current tty:
Sample output from my Ubuntu 18.04 LTS server.
Now let us switch to tty2. To do so, type:
Remember you should use «sudo» with chvt command.
Now, check the current tty using command:
You will see that the tty has changed now.
Similarly, you can switch to tty3 using «sudo chvt 3» , tty4 using «sudo chvt 4» and so on.
Chvt command can be useful when any one of your function keys doesn’t work.
To view the total number of active virtual consoles, run:
As you can see, there are two active VTs in my system.
You can see the next unallocated virtual terminal using command:
A virtual console is unused if it is not the foreground console, and no process has it open for reading or writing, and no text has been selected on its screen.
To get rid of unused VTs, just type:
The above command deallocates kernel memory and data structures for all unused virtual consoles. To put this simply, this command will free all resources connected to the unused virtual consoles.
For more details, refer the respective command’s man pages.
Источник
20 Commands for Newbies Who Switched from Windows to Linux
So you are planning to switch from Windows to Linux, or have just switched to Linux? Oops. what I am asking! For what else reason would you have been here.
From my past experience when I was new, Linux commands and terminals really scared me, I was worried about the commands, as to what extent I have to remember and memorize commands to get myself fully functional with Linux.
No doubt online documentation, Linux books, man pages, and user community helped me a lot but I strongly believed that there should be an article with basic Linux commands in easy-to-learn and understand language. These Motivated me to Master Linux and to make it easy to use. This article is a step towards it.
1. Command: ls
The command “ls” stands for (List Directory Contents), List the contents of the folder, be it file or folder, from which it runs.
The command “ls -l” lists the content of the folder, in a long listing fashion.
Command “ls -a“, list the content of a folder, including hidden files starting with ‘.’ .
Note: In Linux file name starting with ‘ . ‘ is hidden. In Linux, every file/folder/device/command is a file. The output of ls -l is:
- d (stands for directory).
- rwxr-xr-x is the file permission of the file/folder for the owner, group, and world.
- The 1st ravisaive in the above example means that the file is owned by user ravisaive.
- The 2nd ravisaive in the above example means the file belongs to the user group ravisaive.
- 4096 means file size is 4096 Bytes.
- May 8 01:06 is the date and time of the last modification.
- And at the end is the name of the File/Folder.
For more “ls” command examples read our series of articles:
2. Command: lsblk
The “lsblk” stands for (List Block Devices), print block devices by their assigned name (but not RAM) on the standard output in a tree-like fashion.
The “lsblk -l” command list block devices in the ‘list‘ structure (not tree-like fashion).
Note: lsblk is a very useful and easiest way to know the name of the New Usb Device you just plugged in, especially when you have to deal with disk/blocks in the terminal.
3. Command: md5sum
The “md5sum” stands for (Compute and Check MD5 Message-Digest), md5 checksum (commonly called a hash) is used to match or verify the integrity of files that may have changed as a result of a faulty file transfer, a disk error, or non-malicious interference.
Note: The user can match the generated md5sum with the one provided officially. Md5sum is considered less secure than sha1sum, which we will discuss later.
4. Command: dd
Command “dd” stands for (Convert and Copy a file), can be used to convert and copy a file and most of the time is used to copy an iso file (or any other file) to a usb device (or any other location), thus can be used to make a bootable USB stick.
Note: In the above example the usb device is supposed to be sdb1 (You should Verify it using the command lsblk, otherwise you will overwrite your disk and OS), use the name of the disk very Cautiously.
dd command takes some time ranging from a few seconds to several minutes in execution, depending on the size and type of file and read and write speed of Usb stick.
5. Command: uname
The “uname” command stands for (Unix Name), print detailed information about the machine name, Operating System and Kernel.
Note: uname shows the type of kernel. uname -a output detailed information. Elaborating the above output of uname -a.
- “Linux“: The machine’s kernel name.
- “tecmint“: The machine’s node name.
- “3.8.0-19-generic“: The kernel release.
- “#30-Ubuntu SMP“: The kernel version.
- “i686“: The architecture of the processor.
- “GNU/Linux“: The operating system name.
6. Command: history
The history command stands for History (Event) Record, it prints the history of a long list of executed commands in the terminal.
Note: Pressing “Ctrl + R” and then search for already executed commands which lets your command be completed with the auto-completion feature.
7. Command: sudo
The “sudo” (superuser do) command allows a permitted user to execute a command as the superuser or another user, as specified by the security policy in the sudoers list.
Note: sudo allows users to borrow superuser privileged, while a similar command ‘su‘ allows users to actually log in as superuser. Sudo is safer than su.
It is not advised to use sudo or su for day-to-day normal use, as it can result in serious error if accidentally you did something wrong, that’s why a very popular saying in the Linux community is:
8. Command: mkdir
The “mkdir” (make directory) command creates a new directory with a name path. However is the directory already exists, it will return an error message “cannot create a folder, folder already exists”.
Note: Directory can only be created inside the folder, in which the user has to write permission. mkdir: cannot create directory `tecmint‘: File exists.
(Don’t confuse with a file in the above output, you might remember what I said at the beginning – In Linux, every file, folder, drive, command, script are treated as a file).
9. Command: touch
The touch command stands for (update the access and modification times of each FILE to the current time). touch command creates the file, only if it doesn’t exist. If the file already exists it will update the timestamp and not the contents of the file.
Note: touch can be used to create a file under the directory, on which the user has to write permission, only if the file doesn’t exist there.
10. Command: chmod
The Linux “chmod” command stands for (change file mode bits). chmod changes the file mode (permission) of each given file, folder, script, etc.. according to the mode asked for.
There exist 3 types of permission on a file (folder or anything but to keep things simple we will be using file).
So if you want to give only read permission on a file it will be assigned a value of ‘4‘, for write permission only, a value of ‘2‘ and for execute permission only, a value of ‘1‘ is to be given. For read and write permission 4+2 = ‘6‘ is to be given, and so on.
Now, permission needs to be set for 3 kinds of users and user groups. The first is the owner, then the user group, and finally the world.
Here the root’s permission is rwx (read, write and execute).
usergroup to which it belongs, is r-x (read and execute only, no write permission) and
for the world is –x (only execute).
To change its permission and provide read, write and execute permission to the owner, group, and world.
only read and write permission to all three.
read, write and execute to the owner and only execute to group and world.
Note: one of the most important commands useful for sysadmin and user both. On a multi-user environment or on a server, this command comes to the rescue, setting wrong permission will either make a file inaccessible or provide unauthorized access to someone.
11. Command: chown
The Linux “chown” command stands for (change file owner and group). Every file belongs to a group of users and an owner. It is used to do ‘ls -l‘ into your directory and you will see something like this.
Here the directory Binary is owned by user “server” and it belongs to usergroup “root” whereas directory “Desktop” is owned by user “server” and belongs to user group “server“.
This “chown” command is used to change the file ownership and thus is useful in managing and providing files to authorized users and usergroup only.
Note: “chown” changes the user and group ownership of each given FILE to NEW-OWNER or to the user and group of an existing reference file.
12. Command: apt
The Debian-based apt command stands for (Advanced Package Tool). Apt is an advanced package manager for Debian based system (Ubuntu, Kubuntu, etc.), that automatically and intelligently search, install, update and resolves dependency of packages on Gnu/Linux system from the command line.
Note: The above commands result in system-wide changes and hence requires a root password (Check ‘ # ‘ and not ‘ $’ as prompt). Apt is considered more advanced and intelligent as compared to yum command.
As the name suggests, apt-cache searches for a package containing sub package mpalyer. apt-get install, update all the packages, that are already installed, to the newest one.
[ You might also like: 25 APT-GET and APT-CACHE Commands ]
13. Command: tar
The tar command is a Tape Archive is useful in the creation of an archive, in a number of file format and their extraction.
Note: A ‘tar.gz‘ means gzipped. ‘tar.bz2‘ is compressed with bzip which uses a better but slower compression method.
14. Command: cal
The “cal” (Calendar), is used to displays the calendar of the present month or any other month of any year that is advancing or passed.
Show calendar of the year 1835 for the month of February, which already has passed.
Shows calendar of the year 2145 for the month of July, which will be advancing
Note: You need not turn the calendar of 50 years back, neither you need to make a complex mathematical calculation to know what day you were worn or your coming birthday will fall on which day.
15. Command: date
The date command prints the current date and time on the standard output, and can further be set.
Note: This Command will be very useful in scripting, time, and date-based scripting, to be more perfect. Moreover changing the date and time using the terminal will make you feel GEEK. (Obviously, you need to be root to perform this operation, as it is a system-wide change).
16. Command: cat
The “cat” stands for (Concatenation). Concatenate (join) two or more plain files and/or print contents of a file on standard output.
Note: “ >> ” and “ > ” are called append symbol. They are used to append the output to a file and not on standard output. “ > ” symbol will delete a file already existed and create a new file hence for security reasons it is advised to use “ >> ” that will write the output without overwriting or deleting the file.
Before proceeding further, I must let you know about wildcards (you would be aware of wildcard entry, in most of the Television shows) Wildcards are a shell feature that makes the command line much more powerful than any GUI file manager. You see, if you want to select a big group of files in a graphical file manager, you usually have to select them with your mouse. This may seem simple, but in some cases, it can be very frustrating.
For example, suppose you have a directory with a huge amount of all kinds of files and subdirectories, and you decide to move all the HTML files, that have the word “Linux” somewhere in the middle of their names, from that big directory into another directory. What’s a simple way to do this? If the directory contains a huge amount of differently named HTML files, your task is everything but simple!
In the Linux command line that task is just as simple to perform as moving only one HTML file, and it’s so easy because of the shell wildcards. These are special characters that allow you to select file names that match certain patterns of characters. This helps you to select even a big group of files by typing just a few characters, and in most cases, it’s easier than selecting the files with a mouse.
Here’s a list of the most commonly used wildcards :
! is called not a symbol, and the reverse of string attached with ‘!’ is true.
17. Command: cp
The “copy” stands for (Copy), it copies a file from one location to another location.
Note: cp is one of the most commonly used commands in shell scripting and it can be used with wildcard characters (Describe in the above block), for customized and desired file copying.
18. Command: mv
The “mv” command moves a file from one location to another location.
Note: mv command can be used with wildcard characters. mv should be used with caution, as moving of system/unauthorized file may lead to security as well as a breakdown of the system.
19. Command: pwd
The pwd command (print working directory), prints the current working directory with the full pathname from the terminal.
Note: This command won’t be much frequently used in scripting but it is an absolute lifesaver for a newbie who gets lost in the terminal in their early connection with Linux. (Linux is most commonly referred to as nux or nix).
20. Command: cd
Finally, the frequently used cd command stands for (change directory), which changes the working directory to execute, copy, move write, read, etc. from the terminal itself.
Note: cd comes to the rescue when switching between directories from the terminal. “Cd
” will change the working directory to the user’s home directory, and is very useful if a user finds himself lost in the terminal. “cd ..” will change the working directory to parent directory (of current working directory).
These commands will surely make you comfortable with Linux. But it’s not the end. Very soon I will be coming with other commands which will be useful for ‘Middle-Level User. You will notice promotion in user-level from newbie to Middle-level-user.
In the next article, I will be coming up with commands like ‘Kill‘, ‘ps‘, ‘grep‘.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Источник