linux项目经验

    科技2025-03-16  27

    linux项目经验

    During these pandemic days ,I haven’t had an idea of exploring Linux , in fact that made me productive! Yes Linux made me productive which I came to know from my friend said “just give a glance on it”. And yea! I thought anyway it’s going to be boring but when I took a glance about the September edition #IBelieveinDoing which was impressive! And I felt that I can do this and update a new skill so I started my Linux journey. So this edition consists of 2 parts one is about Linux and another one is about Git. If you asks Linux and Git are different? No, they are not .Linux is an open source OS and git is a distributed version-control system for tracking changes in source code during software development. My experience towards Linux was super fun! I enjoyed studying Linux than Git, Git was competitive and quite complex but it was challenging. Now lets go into my Linux journey!

    在这些大流行的日子里,我还没有探索Linux的想法,实际上这使我变得高效! 是的,Linux使我变得富有成效,我从我的朋友那里得知我说:“只要看一眼即可”。 是的! 我本来以为这会很无聊,但是当我瞥一眼9月版的#IBelieveinDoing时,那真是令人印象深刻! 而且我觉得我可以做到这一点并更新新技能,因此我开始了Linux之旅。 因此,该版本包括两部分,一个是关于Linux的,另一个是关于Git的。 如果您问Linux和Git不同? 不,不是。Linux是一个开放源代码操作系统,而git是一个分布式版本控制系统,用于在软件开发过程中跟踪源代码的更改。 我对Linux的体验非常有趣! 我比Git更喜欢学习Linux,Git具有竞争力并且相当复杂,但是充满挑战。 现在开始我的Linux之旅!

    Basic commands of Linux that we have to know:

    我们必须了解的Linux基本命令:

    1. pwd :

    1.密码:

    You can use the pwd command to print the working directory.....

    您可以使用pwd命令打印工作目录。 ....

    2. ls:

    2. ls:

    To list the contents of a directory, you use the ls command when you run the ls command without any arguments, it lists the contents of the present working directory by default.

    要列出一个目录的内容,您可以使用ls当你运行该命令ls命令不带任何参数,默认情况下它会列出当前工作目录的内容。

    3. cd:

    3.光盘:

    You can change to a different directory using the cd command

    您可以使用cd命令更改到其他目录

    Rm command : rm command is used to remove objects such as files, directories and so on

    rm命令:rm命令用于删除对象,例如文件,目录等

    Cp command : used to copy from one file to an other file.

    cp命令:用于从一个文件复制到另一文件。

    Mv command : used to rename /move the files from one place to another.

    Mv命令:用于将文件从一个位置重命名/移动到另一位置。

    The Linux Directory Structure:

    Linux目录结构:

    The Linux directory structure is like a tree. The base of the Linux file system hierarchy begins at the root. Directories branch off the root, but everything starts at root. The directory separator in Linux is the forward slash (/).

    Linux目录结构就像一棵树。 Linux文件系统层次结构的基础从根开始。 目录从根分支出来,但是一切都从根开始。 Linux中的目录分隔符是正斜杠(/)。

    2种路径类型: (2 TYPES OF PATH:)

    · Absolute path: An absolute path always contains the root element and the complete directory list required to locate the file.

    ·绝对路径:绝对路径始终包含根元素和查找文件所需的完整目录列表。

    · Relative path: A relative path is a way to specify the location of a directory relative to another directory.

    ·相对路径:相对路径是一种指定目录相对于另一个目录的位置的方法。

    下表列出了特殊的相对路径,其他代码示例在下面的代码块中。 (A list of special relative paths is listed in the table below and additional examples are in the code block that follows.)

    附加示例: (Additional example:)

    Linux commands can be tuned to our requirements by providing flags along with the command when calling them. These are usually a hyphen (-) followed by an alphabet example: -a, -B etc or double-hyphen ( — ) and if u want to find those flags u can follow the command man ls

    通过在调用命令时提供标志以及命令,可以将Linux命令调整为符合我们的要求。 这些通常是连字符(-),后跟一个字母示例:-a,-B等或双连字符(-),如果要查找这些标志,可以按照命令man ls进行操作。

    · NAME — name of the command & short description of what it does

    ·名称-命令的名称及其作用的简短描述

    · SYNPOSIS — how the command is used

    · SYNPOSIS-命令的使用方式

    · DESCRIPTION — detailed info on the usage of the command

    · DESCRIPTION —有关命令用法的详细信息

    Ls -l is the frequent used command which is used to view the list of the content.

    ls -l是常用命令,用于查看内容列表。

    Seems interesting right! you will find it when you explore more commands like this. 似乎很有趣吧! 探索更多类似这样的命令时,您会找到它。

    And if you see in the above image you will see at the below corner as drwxr-xr-x . this particular text is the file permission to run main.

    而且,如果您在上图中看到,您将在下角看到drwxr-xr-x 。 该特定文本是运行main的文件许可权。

    chmod command : chmod command lets us change the access mode of a file. To add executable permission, we use chmod +x <filename>

    chmod命令: chmod命令让我们CH折边文件的访问模式。 要添加可执行权限,我们使用chmod +x <filename>

    R: means permission to read data from a file

    R:表示允许从文件读取数据

    W: means permission to write/edit a file

    W:表示允许写入/编辑文件

    X: means permission to execute a file.

    X:表示执行文件的权限。

    CREATION COMMANDS:

    创建命令:

    Touch command: is used to create, change and modify timestamps of a file.

    触摸命令:用于创建,更改和修改文件的时间戳。

    Cat command: allows us to create single or multiple files, view contain of file, concatenate files and redirect output in terminal or files

    Cat命令:允许我们创建单个或多个文件,查看文件包含,串联文件以及在一个或多个终端中重定向输出

    Tree command: used to recursively list or display the content of a directory in a tree-like format. It outputs the directory paths and files in each sub-directory and a summary of a total number of sub-directories and files

    Tree命令:用于以树状格式递归列出或显示目录的内容。 它输出每个子目录中的目录路径和文件,以及子目录和文件总数的摘要

    In the image you will come to know that:

    在图像中,您将了解到:

    1. Directories in blue.

    1.目录为蓝色。

    2. Files are in white.

    2.文件为白色。

    3. Executables are in green.

    3.可执行文件为绿色。

    echo command : echo command is used to print out the value provided to it.

    echo命令: echo命令用于打印提供给它的值。

    Cat command : used to print its content.

    Cat命令:用于打印其内容。

    Grep command : used to filter/search for text using strings or patterns

    Grep命令:用于使用字符串或模式过滤/搜索文本

    Tail command : display the last 10 lines of file.

    尾巴命令:显示文件的最后10行。

    Awk command : The awk command programming language requires no compiling, and allows the user to use variables, numeric functions, string functions, and logical operators.

    Awk命令: awk命令编程语言无需编译,并允许用户使用变量,数字函数,字符串函数和逻辑运算符。

    Linux pipe operator (|) :lets you use two or more commands such that output of one command serves as input to the next.

    Linux管道运算符(|):允许您使用两个或多个命令,以使一个命令的输出充当下一个命令的输入。

    SSH LOGIN COMMANDS:

    SSH登录命令:

    Ssh host : connects your host as your local username.

    SSH主机:将您的主机作为本地用户名连接。

    Ssh user@host : connects to the host as user

    SSH user @ host:以用户身份连接到主机

    Ssh –p port user@host : connect to host to port

    ssh –p端口user @ host:连接到主机的端口

    HARD AND SOFT LINK:

    硬和软链接:

    Soft link is an actual link to the original file, whereas the hard link is the mirror copy of the original file. If u deletes the file in soft link it will delete completely because it’s non –existent file. But in a case of hard link its opposite because by a mirror copy where u can have those values of the file.

    软链接是指向原始文件的实际链接,而硬链接是原始文件的镜像副本。 如果u删除软链接中的文件,由于它不存在,它将被完全删除。 但是在硬链接的情况下则相反,因为通过镜像副本,您可以拥有文件的那些值。

    Ln command :

    Ln命令:

    used to create a hard link or a symbolic link (symlink) to an existing file or directory. The use of a hard link allows multiple filenames to be associated with the same file since a hard link points to the inode of a given file, the data of which is stored on disk.

    用于创建到现有文件或目录的硬链接或符号链接(符号链接)。 硬链接的使用允许将多个文件名与同一个文件关联,因为硬链接指向给定文件的索引节点,该文件的数据存储在磁盘上。

    # Create symbolic link to linkname

    #创建指向链接名的符号链接

    ln -s /path/to/file linkname

    ln -s / path / to /文件链接名

    TYPES OF ASSIGNING PERMISSIONS:

    分配权限的类型:

    1.RELATIVE PERMISSIONS:

    1.相对许可:

    2.ABSOLUTE PERMISSIONS: use numbers to represent the file permissions which represent each in a octal mode.(4 2 1)

    2.绝对权限:使用数字表示文件权限,这些权限以八进制模式表示。(4 2 1)

    For eg:

    例如:

    -xr-xr-xr-x = 555 -xr-xr -xr-x = 555 =5 , same for the all the file . = 5,对于所有文件相同。

    -R : option flag lists directory tree recursively

    -R :选项标志递归列出目录树

    Syntax: ls –R [options]

    语法:ls –R [选项]

    -f : prints new lines .

    -f :打印新行。

    -r : option flag lists directories in reverse order

    -r :选项标志以相反的顺序列出目录

    -p : create directory or sub directory at a time.

    -p :一次创建目录或子目录。

    I : used to show the ip address of the host.

    I :用来显示主机的IP地址。

    COMMANDS TO REMOVE :

    要删除的命令:

    1. rm file : remove a file

    1. rm文件:删除文件

    2. rm –r directory : removes the directory and its content

    2. rm –r目录:删除目录及其内容

    3. rm –r file: : removes the files

    3. rm –r file ::删除文件

    4. rm –rf : removes the working directory.

    4. rm –rf :删除工作目录。

    GIT:

    GIT:

    Basic workflow in Git:

    Git中的基本工作流程:

    · State of the file according to the actions

    ·根据操作的文件状态

    BASIC COMMANDS OF GIT:

    Git基本命令:

    git init :

    git init:

    This command turns a directory into an empty Git repository. This is the first step in creating a repository. After running git init, adding and committing files/directories is possible.

    此命令将目录转换为空的Git存储库。 这是创建存储库的第一步。 运行git init之后,可以添加和提交文件/目录。

    git add:

    git添加:

    Add all unshared files.

    添加所有未共享的文件。

    git commit:

    git提交:

    Record the changes made to the files to a local repository. For easy reference, each commit has a unique ID.

    将对文件所做的更改记录到本地存储库中。 为了便于参考,每个提交都具有唯一的ID。

    git status:

    git状态:

    This command returns the current state of the repository.

    此命令返回存储库的当前状态。

    git config:

    git的配置:

    With Git, there are many configurations and settings possible. git config is how to assign these settings. Two important settings are user user.name and user.email. These values set what email address and name commits will be from on a local computer. With git config, a — global flag is used to write the settings to all repositories on a computer. Without a — global flag settings will only apply to the current repository that you are currently in.

    使用Git,可以进行许多配置和设置。 git config是如何分配这些设置。 两个重要设置是用户user.name和user.email。 这些值设置将来自本地计算机的电子邮件地址和名称提交。 对于git config ,一个-全局标志用于将设置写入计算机上的所有存储库。 不带-全局标志设置将仅应用于您当前所在的当前存储库。

    git checkout:

    git checkout:

    To start working in a different branch, use git checkout to switch branches.

    要开始在其他分支中工作,请使用git checkout切换分支。

    git merge:

    git合并:

    Integrate branches together. git merge combines the changes from one branch to another branch. For example, merge the changes made in a staging branch into the stable branch.

    将分支整合在一起。 git merge合并从一个分支到另一分支的更改。 例如,将在暂存分支中所做的更改合并到稳定分支中。

    git clone:

    git克隆:

    To create a local working copy of an existing remote repository, use git clone to copy and download the repository to a computer. Cloning is the equivalent of git init when working with a remote repository. Git will create a directory locally with all files and repository history.

    要创建现有远程存储库的本地工作副本,请使用git clone复制该存储库并将其下载到计算机。 使用远程存储库时,克隆等效于git init 。 Git将在本地创建一个包含所有文件和存储库历史记录的目录。

    git pull:

    git pull:

    To get the latest version of a repository run git pull. This pulls the changes from the remote repository to the local computer.

    要获取最新版本的存储库,请运行git pull 。 这会将更改从远程存储库拉到本地计算机。

    git push:

    git push:

    Sends local commits to the remote repository. git push requires two parameters: the remote repository and the branch that the push is for.

    将本地提交发送到远程存储库。 git push需要两个参数:远程存储库和推送所针对的分支。

    Here comes the conclusion of my journey, so here you have it. I had a super fun journey, I hope after reading this, you also had super fun like me ha ha. I had a amazing experience in Linux thanks to the Crio team for giving this amazing opportunity which I had been productive no no Linux made me productive! I hope you read my Linux experience and had fun . Did u find this information was useful like i had? If u feel then share your comments and opinions what did you felt! I hope I will continue learning new stuff and post my blog whatever new experience comes my way. Thanks for listening!

    这是我旅行的总结,所以就在这里。 我有一个超级有趣的旅程,希望阅读完这篇文章后,您也像我一样超级有趣哈哈。 感谢Crio团队为我提供了这个令人惊奇的机会,这让我获得了丰硕的经验,而Linux却使我变得富有成效! 希望您阅读我的Linux经验并从中获得乐趣。 您是否发现此信息像我一样有用? 如果您觉得满意,请分享您的评论和意见,您的感受! 我希望我会继续学习新知识,并以我的新经历发布我的博客。 谢谢收听!

    REFERENCES:

    参考资料:

    Crio.do

    Crio.do

    Crio.Do: A Project-Based Learning Platform for Software Developers

    Crio.Do:面向软件开发人员的基于项目的学习平台

    Get real software development experience. Work on challenging projects. Learn in-demand tech skills to excel in your career. https://learn.crio.do/home

    获得真正的软件开发经验。 从事具有挑战性的项目。 学习点播技术技能,以在您的职业生涯中脱颖而出。 https://learn.crio.do/home

    http://guides.beanstalkapp.com/version-control/common-git-commands.html

    http://guides.beanstalkapp.com/version-control/common-git-commands.html

    翻译自: https://medium.com/swlh/my-linux-experience-c696cd409ff7

    linux项目经验

    相关资源:PBS系统项目实施经验
    Processed: 0.011, SQL: 8