Ladies and gentlemen, crossing, the last time we were talking about DIY date command example, this time we say the example is:DIY pwd command . Gossip Hugh, words return to the positive. Let's talk C chestnuts together!Crossing, when you switch
This article is the 9th article in the D4D series, in this article to introduce you to learn Docker the most efficient way, you do not need to build your own environment, do not worry about your own development environment, you need only a browser,
1. pwd : Outputs the current working directorycommand format: pwd [OPTION] ...Example: [email protected] etc]# pwd/etc2. Echo: echo textCommand format:echo [Short-option] ... [STRING] ...Echo long-optionOptions: - N No line break after output
/* pwd command path name through the stack storage, first into the stack storage, and then out of the stack output */#include #include #include #include #include #include #define NUM 40/* defining Nodes */struct node {
Linux pwd command C realizes the whole idea
To implement the PWD command:
Enter PWD at the command line: Displays the path that is now located.
Study the system calls required to implement PWD
We can get the system call function
1. Directory Operations:(1) CD (Switch directory)CD ~ Back to home directoryCD Back to home directoryCd.. Back to top directoryCD-Go back to the directory just nowCd/var/spool/mail Absolute PathCd.. /mqueue relative Path (written by/var/spool/mail
Linux Programming Implementation PWD commandIn Linux, everything is file. Directory is actually a kind of file, but this file is very special, it is stored in a corresponding table, that is, the file name and I node of the corresponding relational
#include #include#include#include#include#includestring.h>#include/* Dir *opendir (const char *pathname), which is the open file directory, returns a pointer to the dir struct __dirstream {void *__fd; Char *__data; implement int
In the Linux system, a lot of operations are implemented through commands, the most basic is three commands, the equivalent of the mouse inside the windows of some of the actions, let's look at these three commands.LS View the contents of the
Idea: (1) get "." The I node number, which is called N (using stat)(2) ChDir. (using ChDir)(3) Find the node with inode number n and get its file name.Repeat the operation until the current directory "." The inode value equals "..." The Inode
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.