linux practice test

Want to know linux practice test? we have a huge selection of linux practice test information on alibabacloud.com

Linux IPC Practice (5)--system v Message Queuing (2)

/MSGRCV, Message Send/Receive practice **///1. Message sent int main () {int msgid = Msgget (0x1234,0666| Ipc_creat); if (MsgId = =-1) err_exit (" msgget error"); struct msgbuf mybuffer; for (int i 2. Message reception: The data is constantly taken from the head of the team int main (int argc, char *argv[]) { int msgid = msgget (0x1234, 0); if (MsgId = =-1) err_exit ("Msgget error"); struct MSGBUF buf; ssize_t NRCV; while (

Linux Basics Command Practice Day2

another terminal, modify the user permission of Dir directory in turn)5) Create a new file in Dir directory Tom.txt, the owner is Tom, the group is the Group1,/test directory permissions of 7776) New user rose, switch to Rose User, verify the Rose User's rwx permissions to Tom.txt (open another terminal, modify tom.txt others permissions to match the verification process)7) Add rose to the group1 group and, under the Rose user, verify the rwx permiss

Linux inter-process communication (IPC) Programming Practice (iii) Details System V Message Queue (1)

Linux inter-process communication (IPC) Programming Practice (iii) Details System V Message Queue (1)Message Queue introduction Message Queue provides a method for sending a piece of data (local) from one process to another. Each data block is considered to be of a type, the data blocks received by the recipient process can have different types of values. Message queues have the same limitations as pipeline

Linux device-driven platform bus practice session (III)

struct body of the Structled_classdev type we want to register myled.name=pdata->name;// The name of the LED device on the current match myled.brightness=255;myled.brightness_set=whyx210_led1_set;// This myled Brightness_set method binding can not actually be fixed whyx210_led1_set this method, because we // The driver and equipment matching is not fixed is led1, it is possible that the LED2 device is also matched with this driver, the total can not led2 //How to use the method of led1//To

Socket programming Practice under Linux (10) basic UDP programming details

truncation is attached:int main () {int SOCKFD = socket (af_inet, SOCK_DGRAM, 0); if (SOCKFD = =-1) err_exit ("Socket error"); struct sockaddr_in servaddr; servaddr.sin_family = af_inet; SERVADDR.SIN_ADDR.S_ADDR = htonl (Inaddr_any); Servaddr.sin_port = htons (8001); if (Bind (SOCKFD, (const struct sockaddr *) servaddr, sizeof (servaddr)) = =-1) err_exit ("Bind error"); Send yourself data if (SendTo (SOCKFD, "ABCDE", 5, 0, (const struct sockaddr *) servaddr, siz

Linux Multithreading Practice (8)--posix condition variables to solve the problem of producer consumers

producer_count = 5;//producer Number const unsigned int consumer_count = 3;//consumer number//Definition condition class condition cond ;//Buffer ~o (∩_∩) o~int nready = 0;//consumer void *consumer (void *args) {int id = * (int *) args; Delete (int *) args; while (true) {Cond.lock (); Lock the Mutex while (!) ( Nready > 0) {printf ("--Thread%d wait...\n", id); Cond.wait (); Wait for the condition variable} printf ("* * thread%d alive, and consume product%d ... \ n"

Linux OPS Practice case-December 20, 2015-December 31 (first time)

underlined) followed by a set of parentheses line;# Cat/etc/rc.d/init.d/functions | Egrep "\5 , use echo to output a path, and then egrep find its path base name, and further use Egrep to remove its directory name (note that the directory name, not the directory path);6 , look for all files that do not belong to root, bin, or Hadoop in the/usr directory;# find/usr-not \ (-user root-o-user bin-o-user hadoop \)-ls7 , one day the system was invaded, hackers in your system to leave the Trojan file:

(i) Linux timed Task Setup crontab basic Practice

a/etc/crontab, so we configure this file can also use the Cron service to do something. The crontab configuration is for a user, while the edit/etc/crontab is a task for the system. The file format for this file is:Shell=/bin/bashPath=/sbin:/bin:/usr/sbin:/usr/binMailto=root//If an error occurs, or if there is data output, the data is sent to this account as an emailhome=///user-run path, here is the root directory# Run-parts* * * * * root run-parts/etc/cron.hourly//hourly executionScripts with

Study Notes for Linux practice engineers 7

LinuxAccess Network neighbors 1. Mount Method # Mount-T smbfs // 192.168.0.1/Linux/mnt Or # mount. CIFS/192.168.0.1/Linux/mnt 2. # smbclient // 192.168.0.1/Linux-u RedHat % 123 Access Control Public = Yes allow all users to access = No anonymous access is not allowed 1. Set a valid user for the shared directory [RedHat] Path =/var/RedHat Comment = R

Linux process Practice (2)--zombie process and file sharing

main () {int inumber = 0; pid_t pid = Vfork (); if (PID = =-1) {perror ("fork"); return-1; } else if (PID > 0) {cout Example 2: case where the parent process/child process modifies global data int main () { int inumber = ten; cout //Example 3: Executes the Hello program under the current directory with vfork int main () {int inumber = 0; pid_t pid = Vfork (); if (PID = =-1) {perror ("fork"); return-1; } else if (PID > 0) {cout

Linux practice engineer study Note 5: Disk quota

Linux practice engineer study Note 5: Use the disk quota or modify the/etc/fstab file to enable the quota for each file system-add the option usrquota The default system kernel supports quota. Mount-o usrquota, maid/dev/sdb1/mnt/d1 or Mount-o remount, usrquota, kgquota/ You can also modify the/etc/fstab file to enable the quota of each file system-add the options usrquota Example: Set LABEL =/home ext3 defa

Linux Multithreading Practice (iv) specific data for threads

TSD.specific data; with the key-value Implementation, a thread creates a key, another thread creates it, But not pointing to the same fast memory, they point to their own data,This is thread-specific data.In the code above, even Sleeep (2), thread 1 's data is not affected by thread 2 's data, because it is thread-private. When the thread exits, it is destroyed 2 times because two threads were created. where Tid is the thread's id,str is passed to the Thread_routine parameter, you can see tha

Linux multithreading practice (6) Use Posix condition variables to solve producer and consumer problems

Linux multithreading practice (6) Use Posix condition variables to solve producer and consumer problems In the previous article, we have already discussed how to use semaphores to solve the producer and consumer problems. Under what circumstances should we introduce conditional variables? Assume that there is a shared resource sum, and the associated mutex is lock_s. assume that the sum operation of each th

Service management of Linux system Management, Ipv6,tcp_wrappers practice

) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/06/59/wKiom1m2kkCwIeL5AAMgwH9Tc7Y055.jpg-wh_500x0-wm_ 3-wmp_4-s_3415807704.jpg "style=" Float:none; "title=" 2017-09-11_18-08-59.jpg "alt=" Wkiom1m2kkcwiel5aamgwh9tc7y055.jpg-wh_50 "/>650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/A5/09/wKioL1m2khqgYFRzAAK4x4B_4WQ733.jpg-wh_500x0-wm_ 3-wmp_4-s_1350431586.jpg "style=" Float:none; "title=" 2017-09-11_18-16-16.jpg "alt=" wkiol1m2khqgyfrzaak4x4b_ 4wq733.jpg-wh_50 "/>650) this.widt

MQTT Protocol Learning and practice (Linux server, Android client example)

of the subscription. A nice day! Go Shopping with me topic message.Mtqq_mosquittoMtqq_mosquittoIn addition to the Android side can send messages, of course, can also receive. Open another terminal and publish a message with the shopping topicmosquitto_pub -t shopping -m "Sorry,I have no time."You can see the Logcat in Android and show that you have received the corresponding message.Mtqq_mosquittoMtqq_mosquittoandroid Project DownloadHttps://github.com/djstava/MqttClientAndroidReference documen

Linux IPC Practice (3)--named FIFO

the same semantics. ).Open rules for Named pipes1) Read Open FIFOO_nonblock Disable (blocked): block until a corresponding process has opened the FIFO for writeO_nonblock Enable(non-blocking): Return to success immediatelyExample 1: Blocking, read-only open int main () { int fd = open ("FIFO", o_rdonly); if (fd = =-1) err_exit ("FIFO open Error"); cout Example 2: Read-only, non-blocking open int main () { int fd = open ("FIFO", o_rdonly| O_nonblock); if (fd = =-1) e

Linux process Practice (4)--wait Avoid zombie processes

-1The difference between wait and waitpid: 1. Before a child process terminates, wait causes its callers to block, and Waitpid has a selection that allows the caller to not block. 2.waitpid does not wait for the first terminated child process: It has several selections that control the specific process it waits for. the 3.wait function is equivalent to a special case of the Waitpid function.Waitpid ( -1, status, 0);Zombie Process (if not wait ...) When a child process finishes running, the assoc

"Linux C Programming Practice"-my error-Correcting notes

All for reference only, welcome anyone to discuss[Page] 151 [position] my_rwl.c [Type] Code error[Description] From the book to see __LINE__, is an underscore, but in fact, the built-in macro is the front and back of each of the two sliding lines, namely _ _line_ _[Page] 195 [position] studyuid.c [Type] Code error[Description] The header file for Strerror () is string.h and needs to be added before code can run[Page] 251 [position] ctrlpocess.c [Type] Code error[description] Read function declar

Unix/linux Programming Practice Tutorial (0:)

(Result,"%.3s%.3s%3d%.2d:%.2d:%.2d%d\n", Wday_name[timeptr-Tm_wday], mon_name[timeptr-Tm_mon], timeptr->tm_mday, timeptr->Tm_hour, Timeptr->tm_min, timeptr->Tm_sec,1900+ timeptr->tm_year); return result;}The doubt is lifted, and you can see that CTime returns a static local char array.System call Lseek Change Open file location:Handling Errors in system callsDetermine the type of error errno.Display error message Perror:The ls-a option lists hidden files:How to write LS:Stat gets file attribute

Beginner Linux four or five unit of the better practice

) The initial group of ADMINCW is Caiwu3) Adminjs Initial Group is Jishu 4) Tom is an additional user of the Shengchan group5) Harry is an additional user of the CAIW group6) Leo is an additional user of the Jishu group7) Create a new administrative user, the user does not belong to the above mentioned three departments650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/08/1F/wKiom1nblRiRWtq5AADorr1M3Fg844.png-wh_500x0-wm_ 3-wmp_4-s_2873800465.png "title=" screenshot from 2017-10-09 20-3

Total Pages: 15 1 .... 11 12 13 14 15 Go to: Go

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.