spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » LINUX » Page 1
Mips Linux: Logging Kernel Panic into mtd partition
You can turn on mtdoops module in the kernel and log the kernel panic traces on to mtd partition. I don't think we can write the panic trace over NFS. However, you may want to explore about ramoops. The following are the steps to configure the kernel to capture the kernel oops on to the mtd flash. Capturing the stack trace after the kernel panic is invaluable to debug the kernel problems particul

Categories : Linux

Prelinking only has effect on relative relocations
It seems some linked libraries are not prelinked, with prelink info outdated or with collisions in the assigned addresses. Either that or you might have bad luck and suffer something like that http://lwn.net/Articles/341313/: About 10% to 50% of the time on i686, this benefit of prelink is trashed by the randomization of the placement of [vdso], also known as linux-gate.so. If the page th

Categories : Linux

rsync: /usr/lib/libpopt.so.0: no version information available (required by rsync)
You get rsync dependencies with [root]# ldd /usr/bin/rsync libacl.so.1 => /lib64/libacl.so.1 (0x0000003aa8c00000) libpopt.so.0 => /usr/lib64/libpopt.so.0 (0x0000003730c00000) libc.so.6 => /lib64/libc.so.6 (0x000000372e800000) libattr.so.1 => /lib64/libattr.so.1 (0x0000003aa8800000) /lib64/ld-linux-x86-64.so.2 (0x000000372e400000) Then you get

Categories : Linux

undefined reference to `ERR_load_crypto_strings'
As answered on the maillist by scott_n but for the record here, swap the order to -lssl -lcrypto. Explanation: for static C libraries in general on nearly all systems, members of library files like libxxx.a are only pulled in by the linker if they define things referenced from translation units already linked i.e. to the left in the command line. OpenSSL libssl has (numerous) references to libcry

Categories : Linux

Linux user not being able to login (/bin/nologin)
The shell for this user is set to a non-existent program in order to prevent user from logging in with interactive shell (ssh, local login). Yet the user can authenticate to do some other stuff like copying files through FTP or SMB. Just run as a root to put a normal shell back. chsh roaming /bin/bash

Categories : Linux

Remove file coding mark but preserve its coding
To remove the BOM from the first line of a file you can use something like this sed -e '1 s/^.//' file.txt. sed commands have two parts an address and a command. Most of the time you see sed used without addresses (which means apply to all lines) but you can restrict the command operation to only specific lines by using addresses. In this case the address is 1 meaning the first line. So the repl

Categories : Linux

How do I use cut to output initial line in different format?
Through sed, $ sed 's/^[^[:space:]]+[[:space:]]+([^[:space:]]+)[[:space:]]+[^:]*:[[:space:]]+([^[:space:]]+)[[:space:]]+[^:]*:[[:space:]]+([^[:space:]]+)[[:space:]]+/1:2:3:/;s/[[:space:]]+/-/g' file 1.2.3.4:xxx:a:Q-W 5.6.7.8:yyy:b:X-Y 9.10.11.12:zzz:c:L-N-X

Categories : Linux

How to pass shell variables as Command Line Argument to a shell script
Bash scripts take arguments after the call of the script not before so you need to call the script like this: ./StatCollection_DBServer.sh DD 50 inside the script, you can access the variables as $1 and $2 so the script could look like this: #!/bin/bash LOG_DIRECTORY="${1}_${2}users" mkdir -m 777 "${LOG_DIRECTORY}" I hope this helps...

Categories : Linux

Extract SAS Enterprise Guide into Unix Server runnable batch?
You have a couple of options from what I'm familiar with, plus I suspect if Dom happens by he'll know more. These answers are based on EG 6.1, which is the current version (ships with 9.4); it's possible some of these things may not be true in earlier versions. First, if you're running Enterprise Guide from Windows, you can schedule the job locally (on any Windows machine with Enterprise Guide).

Categories : Linux

Shell scripts and how to avoid running the same script at the same time on a Linux machine
The normal way of doing this is to write the process id into a file. The first thing the script does is check for the existence of the file, read the pid, check if a process with that pid exists, and for extra paranoia points, if that process actually runs the script. If yes, the script exits. Here's a simple example. The process in question is a binary, and this script makes sure the binary runs

Categories : Linux

Does root overrides read only permisssion(even to root) set to directory in unix?
Short answer is - Yes, Root user can create files in a directory that is marked as Read Only. You may argue - why. But that's the whole point of root account. It's a special user and it can do things that others can't. If you want to prevent the file from accidental modification, you can set the "i" attribute with chattr +i which makes a file unchangeable but root can just unset the attribute fi

Categories : Linux

CMake: Cannot find library without absolute path
It is better to use FIND_LIBRARY than linking manually. If your library is installed as default you don't have to include the version. target_link_libraries(my_exe ldap_r)

Categories : Linux

This script will automatically restart the Tomcat when it exceeds 95% of physical memory
porcentaje=95 usoMemoria=$(ps aux | grep tomcat | grep -v grep | awk '{printf ("%.0f", $4)}') if [ $usoMemoria -ge $porcentaje ]; then echo "Se ha superado el tope (95%) de memoria que se ha establecido para el Tomcat. Se procede a su reinicio automatico" echo "$(date)" echo "Comenzando..." service tomcat7 restart echo "Terminando Script..." fi exit 0 Enjoy it!! Greeting

Categories : Linux

Creating an expression with equal to in shell script
The $ implies substitution. As in, take the contents of the variable and substitute it into the command line at that point. If you want to assign then you must not substitute. TL;DR: Remove the dollar sign to the left of the equals sign.

Categories : Linux

AWS Amazon Linux EC2 Instance: apache user permission denied for write to directories
I'm not a proficient Linux or AWS user, but try adding the apache user to the www group: sudo usermod -a -G www apache Then restart apache: sudo service httpd restart or sudo service apache2 restart Then confirm apache is part of the www group grep 'www' /etc/group That seemed to correct the problem for me. Just an FYI, I set up my EC2 server following these instructions.

Categories : Linux

How do I add a kernel module not compiled in my current kernel in linux
Firstly, I found kernel modules "ceph" and "rbd" is configured as "Y" or "M" A kernel module is configured as either "Y" or "M". If you grep for the module under /boot/config it would be marked either of those. If marked "Y" then the module is already built into the kernel as a STATIC MODULE. You need not rebuild it once again. If marked "M" then the module is still built, but as DY

Categories : Linux

How to use line breaks in eyeD3
eyeD3 can include newline characters in comments. Any shell method for embedding newlines in the comment string will work. Here are three examples: Method 1: Using actual newlines in plain quotes Actual newlines can be embedded in plain quotes: $ eyeD3 --comment=":Rating:This is > an even > better > song" file.mp3 Method 2: Read the comment in from a multi-line file Suppose that w

Categories : Linux

Bash script to find and display oldest file
You can use this function to find oldest file/directory in any directory: oldest() { oldf= for f in *; do # not a file, ignore [[ ! -f "$f" ]] && continue # find oldest entry [[ -z "$oldf" ]] && oldf="$f" || [[ "$f" -ot "$oldf" ]] && oldf="$f" done printf '%s ' "$oldf" } And call it in any directory as: oldest

Categories : Linux

Linux bash script: how to search on a column but return full row?
awk is easier for this: data=$(awk -v col=$col -v term="$term" 'toupper($col)==toupper(term)' file) col - column number term - search term You could also pass field separator with -F if needed.

Categories : Linux

Search within certain folder names for a specific text string - Linux 2.6
OK sorted it finally. Love unix but god it doesn't forgive if you don't know its language! find ./ -name foldername -type f -exec grep -H "string, text, here" {} ; >outputfile.txt & foldername - just that, whatever the foldername is that you want. Note, this site looses the ** around the foldername, so put one either side of the foldername for wildcard searching. "string, text, here" - with

Categories : Linux

Linux web hosting server equivalent code for Windows ASP #Include file statement
It's likely running php, so you can use <?php include 'filename.html' ?> . But it's also probably configured only to parse .php files. So you either need to change your files to be .php or configure your php handler to process .html files.

Categories : Linux

Subsetting a CSV by unique column values
You should be able to use s.th. like this: awk '{ line_date = $1 / 100; print > "out_" line_date ".txt"; }' BTW you might want to avoid 'useless use of cat' by not piping but using awk directly on your file.

Categories : Linux

placing a value in a variable and making it stay
Why don't you use Unix export? VAR=value export VAR The export command will mark each VAR for automatic export to the environment of subsequently executed commands i.e. make the local shell variable VAR global.

Categories : Linux

Trying to launch a file after being found Linux BASH
Since you are renaming it to /root/customfile, the command to run it is now /root/customfile. Or if /root/customfile is a directory, the command is now /root/customfile/.whateverthefilenameis. Because you are already spawning a shell, you might as well run all the commands in a single shell. find . -name ".*" -exec bash -c ' sudo chown root:root {} mv {} /root/customfile /root/custo

Categories : Linux

Vim regular expression find and replace
This command should do what you want: :%s/Filed+=//g :%s/ perform substitution on each line in the buffer Filed+= matches 'File' followed by one or more digits until the first '=' // deletes the matched text g do that on every match on the line

Categories : Linux

Perl Crons Jobs = High Server Load?
Well, if you look at ps -ef you should see which script maps to that process id. You could also use strace -fTt -p <pid> to attach a debugger to a specific process id to see what it's doing. Or you could modify the script to change $0 to something meaningful that tells you which script is which. But it's hard to say without a bit more detail. Is there any chance the script is taking longe

Categories : Linux

How can I extract info from downloaded webpages?
I assume you have all files in one directory, "cd" to that and: grep -i -e "Name" -e "email" -e "http" ./* and improve that when you see the result. That will write into your screen, finally add after that: >> my_collected_things.txt to get it into afile.

Categories : Linux

Not able to connect telnet server (telnet: connect to address ::1: Connection refused)
Can you connet to others ports at localhost, e.g. number 23? If yes, are you sure that there's service (program, deamon, etc) that is listened this port? What does 'netstat --inet -apn | grep 5038' tell you? To be sure you could try to use netcat for listenning any port.

Categories : Linux

Passing spaces conteined string to script
Give $1 in double quotes since filename has space. ffmpeg -i "$1".ts -movflags +faststart -vcodec h264 -acodec mp3 -f mpegts "$1"-new.ts and run the script without .ts ./conv_sat_to_clean_ts ./Operacja Dunaj or ./conv_sat_to_clean_ts "Operacja Dunaj"

Categories : Linux

User-data scripts is not running on my custom AMI, but working in standard Amazon linux
User Data should execute fine without using #cloud-boothook (which is used to activate the User Data at the earliest possible time during the boot process). I started a new Amazon Linux AMI and used your User Data, plus a bit extra: #!/bin/bash echo 'bar' > /tmp/bar echo 'test' > /home/ec2-user/user-script-output.txt echo 'foo' > /tmp/foo This successfully created three files. User

Categories : Linux

.htaccess redirect anything after "/"
You can place this rule in /xy/.htaccess: RewriteEngine On RewriteBase /yy/ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule !^xx.php$ xx.php [L,NC] For css/js etc make sure to use absolute path in your css, js, images files rather than a relative one. Which means you have to make sure path of these files start either with http:// or a slash /. Otherwise you can try adding this in your page's

Categories : Linux

uboot tftpboot always timeout (using DM9000A NIC)
I've check my u-boot dm9000 driver and found this static int dm9000_send(struct eth_device *netdev, void *packet, int length) { int tmo; struct board_info *db = &dm9000_info; DM9000_DMP_PACKET(__func__ , packet, length); DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */ /* Move data to DM9000 TX RAM */ DM9000_outb(DM9000_MWCMD, DM9000_IO); /* Prepare for TX

Categories : Linux

How to specify geometry (e.g. 1280x720) for a new browser window?
I don't know if you can start a web browser with a specified size but you can resize it after with wmctrl but i guess it is similar to xdotool method (without click) so it's maybe not what your are looking for. E.g #!/bin/sh wid=`wmctrl -l | grep Firefox | grep "Stack Overflow" | cut -d " " -f 1` wmctrl -i -r $wid -e 0,0,0,800,600 -b remove,maximized_vert,maximized_horz If you've got only one

Categories : Linux

Find duplicate Files
There are many similar tools. See here They may not be part of standard distribution. I have used fslint before and found it to be sufficient for my needs.

Categories : Linux

Tabs in string disappear when saved in variable
It's happening because the shell is performing word splitting when passing the arguments to echo. This can be prevented by quoting the variable. echo "$combined" >> file.txt

Categories : Linux

cat passwd | awk -F':' '{printf $1}' Is this command correct?
This is equivalent to awk -F: '{print $1}' passwd. The cat command is superfluous as all it does is read a file. The -F option determines the field separator for awk. The quotes around the colon are also superfluous since colon is not special to the shell in this context. The print invocation tells awk to print the first field using $1. You are not passing a format string, so you probably mean pr

Categories : Linux

How to retain grep color when storing in variable or piping to another command?
Use the option --color=always: data=$(egrep -i --color=always "$search" file.data) By default, grep does not produce color unless the output is going directly to a terminal. This is normally a good thing. The option --color=always overrides that. For occasions when you don't want color, use --color=never.

Categories : Linux

how to edit a file to keep lines of same length only by using shell command
awk 'length() == 12' input.file > output.file There are several tools that will allow you to edit the file directly (gnu sed, perl, etc), but doing so is a mistake. Write the output to a new file, and use the shell to rename if necessary.

Categories : Linux

Run script as another user on Linux
The answer is change from su to sudo. su is primarily for switching users, while sudo is for executing commands as other users. The -u flag lets you specify which user to execute the command as: sudo -u wayne '/home/wayne/script2.sh' gives Sorry user is not allowed to execute

Categories : Linux



Recently Add
unable to convert tab delimited .txt file to csv
Mips Linux: Logging Kernel Panic into mtd partition
Prelinking only has effect on relative relocations
rsync: /usr/lib/libpopt.so.0: no version information available (required by rsync)
undefined reference to `ERR_load_crypto_strings'
Linux user not being able to login (/bin/nologin)
Remove file coding mark but preserve its coding
How do I use cut to output initial line in different format?
How to pass shell variables as Command Line Argument to a shell script
Extract SAS Enterprise Guide into Unix Server runnable batch?
Shell scripts and how to avoid running the same script at the same time on a Linux machine
Does root overrides read only permisssion(even to root) set to directory in unix?
CMake: Cannot find library without absolute path
This script will automatically restart the Tomcat when it exceeds 95% of physical memory
Creating an expression with equal to in shell script
AWS Amazon Linux EC2 Instance: apache user permission denied for write to directories
How do I add a kernel module not compiled in my current kernel in linux
How to use line breaks in eyeD3
Bash script to find and display oldest file
Linux bash script: how to search on a column but return full row?
Search within certain folder names for a specific text string - Linux 2.6
Linux web hosting server equivalent code for Windows ASP #Include file statement
Subsetting a CSV by unique column values
placing a value in a variable and making it stay
Trying to launch a file after being found Linux BASH
Vim regular expression find and replace
Perl Crons Jobs = High Server Load?
How can I extract info from downloaded webpages?
Not able to connect telnet server (telnet: connect to address ::1: Connection refused)
Passing spaces conteined string to script
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.