(No pictures uploaded)
Experiment one Linux command and programming basic experiment
experimental purposes : Understand remote logins, learn putty This software, will use it for remote logins. Learn and master the Linux commands, understand the GCC compiler and VI text Editor application, will be a simple programming language.
Experiment content:
A Linux Command experiment:
Use putty to log on to the 172.23.204.90 server in SSH mode. After logging in,
1. Change your user password (more complex, alphanumeric combinations);
Enter the account directly, then prompted to enter the password, enter the password (password does not show), direct return can be. If you want to change the password, use the passwd password to modify. Change your password to an alphanumeric combination.
2.① View your home directory (the directory automatically entered when you log in);
Enter the PWD password, and the name of your home directory will be displayed. My directory is:/home/sj0703
② See what directories and files are in the home directory (all) in a long format;
Enter the ls–l password to display all the files in the home directory, including the file's properties, size, creation time, and so on.
3.① Create a new empty file to view its property information;
Enter the touch wxh password and enter the ls-l password. Display the file, view the properties of the file you just created, and the property value is-rw-rw-r--。
② change the file property with chmod 777 , and then view the property information;
Enter the chmod 777 WxH password, and then enter the ls-l password. Display the file, view the properties of the file you just created, and the property value is-rwxrwxrwx.
③ Finally, delete the file.
Enter the RM wxh password to delete the WxH file. Check with the ls-l password to confirm that the deletion was successful.
4.① a new subdirectory under the home directory Vivi;
Enter the mkdir vivi password to create the Vivi directory. View with ls-l password to confirm that the creation was successful.
② copies the vivi-br-release.tar.gz in the/tmp directory to the Vivi subdirectory under its own home directory;
Enter the cp–a/tmp/vivi-br-release.tar.gz vivi password in the home directory and copy the file. Enter the CD vivi password, enter the Vivi directory, check with the ls-l password, confirm the copy is successful.
③ The Vivi package file to unlock.
Enter the TAR–ZXVF vivi-br-release.tar.gz password in the Vivi directory for decompression. Check with ls-l password to confirm that the decompression was successful.
5.① View the permissions of the passwd command: LL/USR/BIN/PASSWD, fully interpreting its permissions characteristics.
Enter ll/usr/bin/passwd password, see/USR/BIN/PASSWD permissions for-r-s-x-x, the passwd command permissions are set to SUID special permissions, if the owner is root, then the executor has superuser privileges.
② View Temp Files directory/tmp permissions: LL-D/tmp, fully explain their permissions characteristics.
Enter the ll–d/tmp password and see/tmp permissions as DRWXRWXRWT, stating that the permissions for the TMP directory are set to Sticky-bit special permissions, and that the files stored in the directory only allow them to perform the deletion, move, and so on.
Two Linux Programming Basics Experiment:
1. Use VI Editor to create the following files:
Enter VI in the main directory and enter the vi text editor. The first entry is the edit mode, enter I, into the insert mode to write code, the following program 1 directly copy. Then click the ESC key, and then enter ZZ to exit the VI editor.
Program 1:HELLO.C
#include <stdio.h>
int main (void)
{
printf ("Hello World, Linux programming!/n");
return 0;
}
Then execute the command to compile the program:
# gcc Hello.c-o Hello
See if the executable file Hello is generated.
Perform:
#./hello
View record execution results.
The result is: Hello world,linux programming!
2. Step-by-Step compilation of HELLO.C:
Perform:
# GCC-E Hello.c-o hello.i
Observe the contents of the hello.i.
Perform
# gcc-c Hello.i-o hello.o
Observe whether HELLO.O is generated
Generating hello.o files
# gcc Hello.o-o Hello
See if Hello is generated
Generate Hello File
3. Create the following files with VI Editor: (Step reference 1)
Program 2:ILLCODE.C
#include <stdio.h>
void Main (void)
{
Long Long int var = 1;
printf ("It is not standard C code!/n");
}
Perform:
# Gcc-wall Illcode.c-o Illcode
Observe the output of the record.
4. Create the following files with VI Editor: (Step reference 1)
Program 3:OPTIMIZE.C
#include <stdio.h>
int main (void)
{
Double counter;
Double result;
Double temp;
for (counter = 0;
Counter < 2000.0 * 2000.0 * 2000.0/20.0 + 2020;
Counter + = (5-1)/4) {
temp = counter/1979;
result = Counter;
}
printf ("Result was%lf/n", result);
return 0;