Linux command exercise - help a total noob?

In summary, this conversation is about an exercise in using Linux for a physics course. The assignment involves using various commands to print the date, create a directory, move files, confirm the working directory, print user and group IDs, find the version of a command, report disk space usage, use a text editor to add information to a file, and retrieve the file using sftp. Helpful resources for completing the assignment include using the man command, researching text editors and using putty for sftp.
  • #1
mathman44
207
0
Firstly, I've literally never used a Linux machine in my life. My phys prof thought it would be a good idea to get us acquainted with the system, but didn't want to actually teach it...

The following is an exercise in Linux. I'm having a lot of trouble finding the commands to accomplish this.

Homework Statement



1. Enter the command to print out the date in coordinated universal time (UTC). (Hint: Use a
variant of the man command to help you find the appropriate command.) Now, enter the
same command again, but this time redirect (append) the output to a file called Assign2.txt
by following the command with the expression “>> Assign2.txt” (without quotation
marks).

2. Create a directory called Phy258Ass2 in your home area.

3. Move the file Assign2.txt into the new directory you just created.

4. Change to the new directory Phy258Ass2, i.e., make it your current directory.

5. To confirm that this worked, enter the command to print your current (working) directory.
Re-enter the command, this time redirecting (appending) the output to the file Assign2.txt.

6. Enter the id command to print your user and group IDs. Again, redirect the output to the
Assign2.txt file.

7. The id command has an option that gives you the version of the id program and its authors. Find this option and use it, again redirecting the output to the Assign2.txt file.

8. Find the command that reports file system disk space usage. Use the command and also
redirect its output to the Assign2.txt file.

9. Choose one of the text editors available on the Linux computer to insert the text “Phys 258, Assignment 2”, your name, your ID number, and your lab section at the
top of the file Assign2.txt. Follow this with a line stating the name of the Linux text editor
that you used. Take care not to disturb or alter the text data that you already have in this
file. Exit from the text editor, making sure that your changes get saved.

10. View the file you have just finished creating by using either the more or less command.

11. From a different computer with printing capability, use secure ftp (sftp) to retrieve a copy
of your Assign2.txt file on the applicable undergraduate physics Linux computer. (Note
that the PuTTY package comes with an sftp utility.)

The Attempt at a Solution



Here is my attempt at googling the corresponding commands:

1. date -u
2. mkdir Phys258Ass2
3. mv Assign2.txt Phys258Ass2
4. cd Phys258Ass2
5. ls -f
6. id -u
7.
8. df
9.
10.
11.

:S
 
Last edited:
Physics news on Phys.org
  • #2
hints:
7. <program> --help or <program> -h will often give you a list of commands you can use with a program
9. Google for linux text editors, then pick one. There's a wiki article on this.
11. putty - this is just sorting out how to use a program, and putty documentation tends to be good.

http://linuxcommand.org/learning_the_shell.php
 
  • #3


my advice would be to start by familiarizing yourself with the basic commands and functions of Linux. This can be done through online tutorials or by taking a course specifically on Linux. Once you have a basic understanding of the system, you can then attempt to complete the exercise.

For the first question, the command to print out the date in UTC would be "date -u" as you mentioned. To redirect the output to a file, you would use "date -u >> Assign2.txt".

For question 2, the command to create a directory is "mkdir", so the full command would be "mkdir Phy258Ass2".

For question 3, the command to move a file is "mv", so the full command would be "mv Assign2.txt Phy258Ass2".

For question 4, the command to change directories is "cd", so the full command would be "cd Phy258Ass2".

For question 5, the command to print the current directory is "pwd", so the full command would be "pwd >> Assign2.txt".

For question 6, the command to print user and group IDs is "id", so the full command would be "id >> Assign2.txt".

For question 7, the option to print the version and authors of the id program is "-V", so the full command would be "id -V >> Assign2.txt".

For question 8, the command to report file system disk space usage is "df", so the full command would be "df >> Assign2.txt".

For question 9, the command to open a text editor is usually "nano" or "vi", so the full command would be "nano Assign2.txt". Once in the text editor, you can use the insert key to add the necessary information at the top of the file. To save and exit, you would use the command "Ctrl+X" and then confirm by pressing "Y" and then "Enter".

For question 10, the commands to view a file are "more" or "less", so the full command would be "more Assign2.txt" or "less Assign2.txt".

For question 11, you would need to use a secure file transfer protocol (sftp) client to retrieve the file from the Linux computer. The command would depend on the specific client you are using, so it would be best to refer to the documentation for that client.

Overall, my recommendation would be
 

Related to Linux command exercise - help a total noob?

1. What is a Linux command?

A Linux command is a text-based instruction that is used to perform tasks and operations on a Linux operating system. It is entered into a terminal or command line interface and is executed by the operating system.

2. How do I access the Linux command line?

You can access the Linux command line by opening the terminal application on your computer. This can usually be found in the Applications or Utilities folder, or by using the search function. Alternatively, you can use the keyboard shortcut "Ctrl + Alt + T" to open the terminal.

3. What are some basic Linux commands?

Some basic Linux commands include "ls" to list the contents of a directory, "cd" to change directories, "mkdir" to create a new directory, "touch" to create a new file, and "cp" to copy a file or directory. There are many more commands, but these are some commonly used ones.

4. How do I get help with a specific Linux command?

You can get help with a specific Linux command by using the "man" command followed by the name of the command. This will bring up the manual page for that command, which includes a description, usage instructions, and examples. You can also add the "-h" option to many commands to get a brief summary of their usage.

5. How can I practice and improve my Linux command skills?

There are many ways to practice and improve your Linux command skills. You can start by using the commands in a virtual machine or by dual-booting your computer with a Linux operating system. There are also many online resources and tutorials available, as well as books and courses. Additionally, you can join online communities and forums to ask for help and learn from others.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Replies
16
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
21
Views
5K
  • Programming and Computer Science
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
6K
  • Programming and Computer Science
Replies
1
Views
1K
Back
Top