如何将主目录列表附加到文本文件以及如何移动文件?

时间:2023-01-18 07:48:36

I know a very basic of unix and I am writing a java program which I only need couple of commands to solve my problem.

我知道一个非常基本的unix,我正在编写一个java程序,我只需要几个命令来解决我的问题。

I appreciate if anyone knows how I can get desired output:

如果有人知道如何获得所需的输出,我感激不尽:

  1. What command I can use to append a full list of objects of my home directory to a file "report.txt". Assume I am in different directory?

    我可以用什么命令将我的主目录的完整对象列表附加到文件“report.txt”。假设我在不同的目录中?

  2. What command I can use to move all files in my directory that begin with either a, b, or c, to a subdirectory, sorting, of my current directory?

    我可以使用什么命令将我的目录中以a,b或c开头的所有文件移动到当前目录的子目录中?

  3. If I go to /proc directory. What does this command do?

    如果我去/ proc目录。这个命令做什么用的?

    cd 'ps | grep ps| cut -f 1'

    cd'ps | grep ps | cut -f 1'

I really appreciate if any one can help me out with these.

如果有人能帮我解决这些问题,我真的很感激。

1 个解决方案

#1


1  

  1. What command I can use to append a full list of objects of my home directory to a file "report.txt". Assume I am in different directory?

    我可以用什么命令将我的主目录的完整对象列表附加到文件“report.txt”。假设我在不同的目录中?

    ls -la ~ > report.txt

    ls -la~> report.txt

  2. What command I can use to move all files in my directory that begin with either a, b, or c, to a subdirectory, sorting, of my current directory?

    我可以使用什么命令将我的目录中以a,b或c开头的所有文件移动到当前目录的子目录中?

    mv a* b* c* yourdirectory

    mv a * b * c * yourdirectory

  3. If I go to /proc directory. What does this command do?

    如果我去/ proc目录。这个命令做什么用的?

    cd 'ps | grep ps| cut -f 1'

    cd'ps | grep ps | cut -f 1'

    This command will give "bash: cd: ps | grep ps| cut -f 1: No such file or directory" error

    此命令将给出“bash:cd:ps | grep ps | cut -f 1:没有这样的文件或目录”错误

#1


1  

  1. What command I can use to append a full list of objects of my home directory to a file "report.txt". Assume I am in different directory?

    我可以用什么命令将我的主目录的完整对象列表附加到文件“report.txt”。假设我在不同的目录中?

    ls -la ~ > report.txt

    ls -la~> report.txt

  2. What command I can use to move all files in my directory that begin with either a, b, or c, to a subdirectory, sorting, of my current directory?

    我可以使用什么命令将我的目录中以a,b或c开头的所有文件移动到当前目录的子目录中?

    mv a* b* c* yourdirectory

    mv a * b * c * yourdirectory

  3. If I go to /proc directory. What does this command do?

    如果我去/ proc目录。这个命令做什么用的?

    cd 'ps | grep ps| cut -f 1'

    cd'ps | grep ps | cut -f 1'

    This command will give "bash: cd: ps | grep ps| cut -f 1: No such file or directory" error

    此命令将给出“bash:cd:ps | grep ps | cut -f 1:没有这样的文件或目录”错误