Command to exit directory in linux

exit command in Linux with Examples

exit command in linux is used to exit the shell where it is currently running. It takes one more parameter as [N] and exits the shell with a return of status N. If n is not provided, then it simply returns the status of last command that is executed. Syntax:

Options for exit command –

  • exit: Exit Without Parameter After pressing enter, the terminal will simply close.
  • exit [n] : Exit With Parameter After pressing enter, the terminal window will close and return a status of 110. Return status is important because sometimes they can be mapped to tell error, warnings and notifications. For example generally, return status – “0” means the program has executed successfully. “1” means the program has minor errors.
  • exit n : Using “sudo su” we are going to the root directory and then exit the root directory with a return status of 5. After returning it will show how to display the return status code. echo $? command is used to see the last return status.
  • exit –help : It displays help information.

Источник

How to open and close directories in the Linux terminal

To open a directory on a computer with a graphical interface, you double-click on a folder. It opens, and you are now «in» that folder.

Читайте также:  H264 davinci resolve linux

To open a directory in a terminal, you use the cd command to change your current directory. This essentially opens that folder and places you in it.

$ pwd /home/tux $ ls example.txt Documents Downloads Music Pictures Templates Videos $ cd Documents $ pwd /home/tux/Documents

Close a folder

To close a directory on a computer with a graphical interface, you close the window representing that directory.

You don’t have to close directories in a terminal, but you can always navigate away from a location you’ve made your current directory. The cd command, issued alone with no arguments, takes you back home.

List files on your computer

Use the Linux terminal to see what files are on your computer

Learn how to use the ls command to list files in the terminal with this Linux tutorial.

Avoiding data disasters with Sanoid

20 Linux commands every sysadmin should know

If your application isn’t working—or you’re just looking for more information—these 20 commands will come in handy.

FreeDOS

3 Linux terminals you need to try

Linux gives you the ability to choose the terminal interface you like—not one it imposes.

Seth Kenlon

Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.

1 Comment

It’s also helpful to know the shorthand for moving up in the directory structure.

cd ../
takes you up one level,
cd ../../
takes you up two levels, and so on.

GNOME

Computer laptop in space

Painting art on a computer screen

Creative Commons License

This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.

About This Site

The opinions expressed on this website are those of each author, not of the author’s employer or of Red Hat.

Читайте также:  Linux find include files

Opensource.com aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. Red Hat and the Red Hat logo are trademarks of Red Hat, Inc., registered in the United States and other countries.

A note on advertising: Opensource.com does not sell advertising on the site or in any of its newsletters.

Источник

Оцените статью
Adblock
detector