w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » LINUX » Page 1
In which file does the syscall num defined in linux 3.13?
You should be able to find the syscall number defines in unistd.h for the appropriate architecture, and the corresponding sys_-functions with argument information in syscalls.h.

Categories : Linux

Unity Build for Embedded Processors
Unity's Standalone Linux builds only supports x86 and x64 CPUs, and does not support ARM, so there's no way to launch them on Raspberry Pi board. Even if it did support, there would be no guarantee that Linux running on Raspberry Pi would have all the necessary libraries to run your builds.

Categories : Linux

How to count the number of columns in the header of a csv file?
If you are sure that you have always the same number of columns, print NF only for the first line: awk -F, 'NR==1{print NF}' ./test.csv You could also use head without temporary files: awk -F, '{print NF}' <(head -1 f) head -1 f |awk -F, '{print NF}'

Categories : Linux

Fail2Ban is unable to block ip after multiple try
To configure fail2ban, make a 'local' copy the jail.conf file in /etc/fail2ban cd /etc/fail2ban sudo cp jail.conf jail.local Try to restart with default configuration also before editing anything.

Categories : Linux

SonarQube server can not be reached at http://localhost:9000 with Sonarqube-4.5.1
Just ran into this issue this morning. Resolved it by configuring the server to access the MySQL database: http://docs.codehaus.org/display/SONAR/Installing You want to edit the {sonar_home}/conf/sonar.properties and uncomment the url, username, and password. You might have to add a new database user if you would like.

Categories : Linux

Automating services with Linux OS starting up and shutting down
You should install init script for your program. The standard way is to follow Linux Standards Base section 20 subsections 2-8 The idea is to create a script that will start your application when called with argument start, stop it when called with argument stop, restart it when called with argument restart and make it reload configuration when called with argument reload. This script should be i

Categories : Linux

u-boot hangs after sucessfull (uboot,kernel,filesystem) upgrade in an embedded product
There are common methods of building a fail-safe upgrade process. Let's assume your u-boot image is of a release quality, and a header with size and checksum has been added to it. You can allocate space for 2 such similar u-boot copies. During upgrade process, the 2nd image checksum is verified, then 1st is replaced. Now 1st image (that was just programmed) checksum is verified, and if successf

Categories : Linux

redirecting output of shell to a file with ampersand returns some additional commands in output
The following line is not appended to the file. [1]+ Done ksh dummy.sh > text It is printed by shell to let you know the background process is terminated. Try cat text again, then you will notice that there's no line with [1] .....

Categories : Linux

How to test tx_timeout operation of a network kernel module?
This email from David Miller answer this question. I tested using another network device driver and it worked very well. The way to test tx_timeout is so simple. If you don't send the packages that are stored in a buffer (or a queue) to the hardware itself. So, those packages will be accumulated until the buffer or queue fill. The next packet may not be stored (and sent), throwing a timeout excep

Categories : Linux

Limit access to proftpd user
One solution is to set up /var/www/site/assets and /var/www/site/views as separate filesystems that are mounted in multiple places. e.g. mount them at their current locations and under /home/bob/. This requires some effort initially but it is likely to be the simplest and most secure solution for your users. See the Filesystem Tricks section in the Proftpd chroot howto.

Categories : Linux

Why this Debian-Linux autostart netcat script won't autostart?
In an rc script you have root level access by default. What does "it stops at the while loop" mean? It quits after a while, or so? I guess you need to run your loop in the background in order to achieve functionality usual in autostart scripts: echo "Starting" ( while read -r line do #some stuff to do done << (nc -l -p 4001) ) & echo "Started with pid $( jobs -p )"

Categories : Linux

How to grant DBSA equivalent rights to OS user on non-root Informix installation?
The DBSA group is determined by the group that owns $INFORMIXDIR/etc. http://www.iiug.org/forums/ids/index.cgi/read/15472 On a non-root installation the DBSA can delegat any other User with DBSA rights through adding that user to that group ALTER USER bill MODIFY UID 1361, ADD GROUP (dbsa), ADD HOME "/u/user1"; http://www-01.ibm.com/support/knowledgecenter/SSGU8G_11.70.0/com.ibm.sqls.doc/ids

Categories : Linux

How do I compile and install an addition kernel on a Debian System
Kernels images must be in your /boot directory and also grub bootloader configuration file there at /boot/grub/grub.cfg If you will open grub.cfg you can see settings of grub menu (it is startup menu when you're turning on your computer). It must looks like this (my grub.cfg): menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-79b185e

Categories : Linux

How to restrict linux user to absolute minimal commands for SSH
You can do it with permissible commands in the authorized_keys file. user would not log in via ssh but will have a restricted set of commands that would only be allowed to execute via ssh, for example "ssh somehost bin/programname" more details here and here

Categories : Linux

How to get indirect access on a file through script in linux
sudo can allow user2 to execute that command as user1. To do that, run sudo visudo. This will open an editor. Add the following line to the bottom of that file user2 ALL=(user1) NOPASSWD: /bin/sed -i s/eg1/eg0/ text1 Save the file and close the editor. After this is done, user2 can execute the command as follows: sudo -u user1 sed -i 's/eg1/eg0/' text1 Notes visudo will open a system-d

Categories : Linux

best way to find os name and version in unix/linux platform
With perl and Linux::Distribution, the cleanest solution for an old problem : #!/bin/sh perl -e ' use Linux::Distribution qw(distribution_name distribution_version); my $linux = Linux::Distribution->new; if(my $distro = $linux->distribution_name()) { my $version = $linux->distribution_version(); print "you are running $distro"; print " version

Categories : Linux

Cronjob for automatic process
No need for scripting, just set it in "crontab" crontab -e * * 24-31 * 1-5 /path/command * * 1-2 * 1-5 /path/command "crontab" can handle ranges and comma separated lists. Please see "man 5 crontab" or this rather good guide: https://help.ubuntu.com/community/CronHowto Depending on where you are located working days may be different. Western working week assumed here i.e. "1-5" = mo

Categories : Linux

how to delete old folders and files that where created or modified x days ago?
First run below command and see if the files are getting listed:- find /directory/tmp -name "*" -mtime +2 -exec ls -l {} ; Here "*" means all. You can write "*.tmp" if files which ends with .tmp extension. If yes, then try:- find /directory/tmp -name "*" -mtime +2 -exec rm -f {} ; Hope this may help you.

Categories : Linux

Why would a loop die?
Depending on what restart.sh does, it appears the script could wait forever if sh restart.sh hangs. By specifying wait with no PID, it will wait until all process IDs known to the invoking shell have terminated (see man 1P wait). If sh restart.sh hangs, wait is never satisfied. If there is no specific requirement to background sleep, why not run sleep in the foreground and omit wait altogether:

Categories : Linux

passing flags to bash script via ssh key
You can use the environment variable SSH_ORIGINAL_COMMAND for this sort of thing. SSH_ORIGINAL_COMMAND This variable contains the original command line if a forced command is executed. It can be used to extract the original arguments

Categories : Linux

How do you force a windows to the top in kali linux using a bash file
No, you can't do this "in bash". You can, with the right other tools, request that the window be raised to the top but the window manager may (or may not) honor that request. Before we get to that though stacking order is generally bottom-to-top so if you start the program you want on top last it should, generally, end up on top in the end. To request that a window be made on top you can use som

Categories : Linux

Looping trough files in directory
ls doesn't display $path itself. You can add it back manually: for file in `ls -- "$path"/` do file="$path/file" # New code line. if [[ -f "$file" ]] then echo "file" fi if [[ -d "$file" ]] then echo "DIR" fi done However, please consider Etan Reisner's comment, and get rid of ls, because it's most probably unnecessary in your use case.

Categories : Linux

Taking Screenshot in perl
Please refer this coding: sub new { my $class = shift; my @params = (); @params = @{shift()} if _ARRAY0($_[0]); my $image = Imager::Screenshot::screenshot( @params ); unless ( _INSTANCE($image, 'Imager') ) { Carp::croak('Failed to capture screenshot'); } # Hand off to the parent class return $class->SUPER::new( image => $image, @_ ); } give thanks to:

Categories : Linux

Open each path in a file and search for a pattern in each file
#!/bin/bash while read line do current_file=$line grep -l "your pattern" $current_file done < "path/to/firstfile" Using grep -l in a loop should work

Categories : Linux

Undo chown and chmod
I think there is no way undo chown and chmod. But you can see default permission of these folder in any other machine which has fresh installation or you can install lampp again in different folder. Then change chown and chmod permissions of /opt/lampp/htdocs to default.

Categories : Linux

Install Windows Server on Dedicated Server
you can use screen to (re)attach your ssh-session to a running process. me@server $ man screen me@server $ screen ./servers.sh [...] Ctrl-a Ctrl-d me@server $ exit me@home $ ssh me@server me@server $ sreen -r [...]

Categories : Linux

How can I help git for Windows better handle a repository sitting on a Linux Samba share?
Ok, after digging some more, I've found the issue was due to different file mode flags because of my Samba configuration. I was able to fix things by disabling the fileMode option at the repo level: git config --unset core.fileMode And setting it globally on the Windows box: git config --global core.fileMode true

Categories : Linux

Bash - getting a unknown amount of arguments from inside a script
Your design is not exactly the best. You should consider using tail with the -f switch (if available for your version) as so: while read -r line; do # do stuff with line done < <(tail -f -n0 logs/latest.log) This will avoid reading the whole file entirely at each iteration and you won't need the sleep 0.1 trick. This also avoids the use of the auxiliary file looking.txt. Now, I guess

Categories : Linux

Use Diff to check changed files in folder structure ignoring lines starting with pattern
A working solution : diff --exclude="cache" --exclude="session" --exclude="tmp" --ignore-matching-lines='copyright *Copyright.*Magento' -urq dir1 dir2 regex simply modified.

Categories : Linux

UNIX - Executing command as root with no sudo/su access
To execute them in a single line. You can pipe(|) any commands with goto root like this goto root | some command some command will executed with root privilege since shell does not complete the current operation.

Categories : Linux

How get value from text file in linux
one way is to use awk to print just the value grep -r "disablelog" oscam.conf | awk '{print $3}' you could also use sed to replace diablelog = with empty grep -r 'disablelog' oscam.conf | sed -e 's/disablelog = //' If you also want to get the lines with or without space before and after = use grep -r 'disablelog' oscam.conf | sed 's/disablelogs*=s*//' above command will also match disab

Categories : Linux

Remove duplicates and take the latest data based on timestamp in a csv file using linux
Let's give a try with this: while IFS="," read -r a b c do printf "%s %s %s %d " "$a" "$b" "$c" $(date -d"$c" +"%s") done < file | awk '{it=$NF; NF-- if (max[$1]<it) {max[$1]=it; res[$1]=$0}} END {for (i in max) print res[i]}' This stores the maximum date in the array max[], which is indexed by the temporary last field which indicates seconds since 1 Jan 1970 (created pre

Categories : Linux

Need help editing multiple files using sed in linux terminal
sed doesn't support folders as input. for d in */; puts folders into $d. If you write sed ... $d, then BASH will put the folder name into the arguments of sed and the poor tool will be confused. Also ~/assets/*/client_custom.css since this will expand to all the files which match this pattern. So sed will be called once with all file names. You probably want to invoke sed once per file name.

Categories : Linux

Start subscript in bash script in background so that it still runs when I close the terminal/ssh session
You can use nohup bash your_script.sh & or disown bash your_script.sh & or screen But my suggestion is screen command. Also tumx is good to use. And for your last requirement to stop script on call will be able to achieved by following command, kill $!

Categories : Linux

Can I run batch script on windows machine through remote WMI?
winexe worked for me to run a Windows console script remotely from my Linux box. Syntax: winexe --user adminuser --password password //computername c:/path/to/script.bat You can even get an interactive session going with something like this: winexe --user adminuser --password password //computername cmd.exe Admin rights on the Windows box are needed for remote access. Also, be advised that

Categories : Linux

Access forbidden to website after scp transfer
To preserve permissions try to use rsync, it has a lot more benefits besides keeping ownership, permissions and incremental copies: rsync -av source 192.0.2.1:/dest/ination EDIT [according to comments]: This works well for transferring between 2 Linux systems but doesn't seem to work for Windows -> Linux transfer. Apparently PuTTY seems to work best for transfers involving Windows on one side

Categories : Linux

Is there a way to change file name without using rename system call?
Yes, you can use link() to create a new name for the file, and unlink() to remove the existing name. Be aware that using link(), or rename(), cannot move files from one file system("mount point") to another, in that case you would need to manually move the file as the answer by @KirChou says.

Categories : Linux

linux script shell : grep a part of path in a list of path
This is one of the cases where -f option from grep comes very handy: grep -f f1 f2 For your given input returns: /home/.../aaa/bbb/file1.ext /home/...ccc/ddd/file2.ext From man grep: -f FILE, --file=FILE Obtain patterns from FILE, one per line. The empty file contains zero patterns, and therefore matches nothing. (-f is specified by POSIX.)

Categories : Linux

Sum the Column based on another column
You need to add minutes to the hour and then count. awk -F, '{ a[substr($1,0,2)+substr($1,4,2)]+=$2 } END{ for (i in a) print i "," a[i] }' 0,19 1,34 Then you may use some math and printf to get formating.

Categories : Linux




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.