csny
  • Member for 7 years, 9 months
  • Last seen this week
Understanding UNIX permissions and file types
0 votes

For the d questions This tells you the Unix file type. By default Unix has only 3 types of files. They are: - - Regular file d - Directory file Special file (with 5 sub-types): b - Block file c - ...

View answer
How to enter the condition to check 0 or more than 0 in case
0 votes

case $([[ $input =~ ^-?[0-9]+$ ]] && [[ $input -gt 0 || $input -eq 0 ]] ; echo $?) in 0) echo "good" ;; 1) echo "bad" ;; *) echo "weird" ;; esac ...

View answer
How much RAM needed for preventing use swap?
-2 votes

A short research pointed out this: Why is swappiness set to 60 by default? which explains in even more details about swappiness And this: https://www.kernel.org/doc/Documentation/sysctl/vm.txt which ...

View answer
Sane way of enumerating python versions from bash
4 votes

If you want the versions that are in $PATH, you can run: python -V ; g++ --version

View answer
Issue with dropping table which contains special char in tablename. (Linux&Postgres)
0 votes

This is what I do when the query is complex shellwize or I have to use any names/variables that better be quoted: Use all the names as variables: tablename="bla" Call psql this way: su - postgres -...

View answer
How to obtain info about physical volume as non root user
4 votes

The pvs command is part of lvm. If you, as root, need to enable non-root users this funtionality, you can use setcap, to set the lvm executable permissions to perform actions that are restricted to ...

View answer
bash dynamic (variable) variable names
2 votes

What I get from your code and your desired output (correct me if I'm wrong): There is no use of the "FIRST"/"SECOND"/... variable names, you just need a loop with an index... This will do the job: ...

View answer
What is the alternative for ls command in linux?
1 votes

If you just want a list of directory contents: find . -maxdepth 1 or for any other dir: find <dir> -maxdepth 1

View answer
Is there a CLI tool that would prettify a JSON string
1 votes

Try echo $ENV_VAR | base64 --decode | json_reformat. If this is a 6.x or higher Centos version, you should have it

View answer
accessing loop variable in a loop
0 votes

a more bash way for what you need: try this: load_1=15231 load_2=20547 load_3=24561 load_4=22874 f4=434 line=`(set -o posix ; set) | grep load_ | sort -t = -n -k2 | head -1` min=`echo $line | ...

View answer
How do daemons like apache or bind open ports below 1024?
2 votes

Any application can be allowed a set of root capabilities using setcap. Opening port below 1024 if one of them. You can run the application as a non-root user, and if the capabilities you need are set,...

View answer
awk print a match only if last record before other match
0 votes

Some googling found me the best answer so far, though I already got an answer: Using tac makes it much simpler... tac file | awk 'NR==2{if ( $1=="c") print $2}' The line number is one after the "...

View answer
Cronjob doesn't execute shell script, but when I am executing it standalone it works. Why?
1 votes

First of all, for debugging purposes, redirect the stderr to some file as well. This way you'll know what goes wrong. 15 * * * * /bin/ksh /wls_domains/resMGT/logs/bea/wlr3queuetransaction.sh 2>...

View answer
how to record all who that login to my linux machines and records them
1 votes

Maybe it takes more effort than using some external tools, but last or utmpdump supply all the needed remote login info using those files (read http://xmodulo.com/monitor-user-login-history-centos-...

View answer
how to know which device was open
1 votes

lsof <your devices> to show the processes that use your device. or strace -p pid to trace a process that you know is supposed to use your device.

View answer
sudo command is unsucessful when invoked from file manager
2 votes

You should verify that sudo doesn't require tty in the /etc/sudoers file (requiretty should not be set).

View answer
which config file is openssh sshd using?
0 votes

In addition to the answers given: Debug mode might be helpful: [root@ip-10-41-162-92 ~]# /usr/sbin/sshd -df /etc/ssh/sshd_config.test debug1: sshd version OpenSSH_6.7, OpenSSL 1.0.1j 15 Oct 2014 ... ...

View answer
Why does ls display a non-existing file?
0 votes

If you need just to list the files/directories without their contents, better use find /usr/bin/ -maxdepth 1 -name "[[:upper:]]*" Anyway better to use find than ls for finding files/dirs /usr/bin/...

View answer
Getting the shellscript to display a chosen file extension
0 votes

A single line command: echo "Enter file extension:" for f in `find <some_path> -name "*$(read n; echo $n)"` ; do echo $f ; done

View answer
Remove a line if regex exists only in 1st column of each line in a csv file
1 votes

grep -v ^24 to keep only lines that do not start with 24

View answer
Tomcat 8 doesn't start
0 votes

There is a difference between tomcat 6 and tomcat 8 catalina.sh java process initiation. In my case the problem was NOT in the endorsed directory, but in setting a different parameter before the ...

View answer
LVM move logical volumes across physical volumes without data loss
0 votes

If you need to free a specific disk - you can use pvmove /dev/sdb It will spread the data among all other disk of the vg. There are lots of cammands under the lvm tool. If you specify your goal the ...

View answer
shellshock solution for nexenta/solaris
2 votes

I got my system updated by downloading 4.3 bash source code and patches from ftp.gnu.org/gnu/bash and compiling it to replace the existing code. It works, now waiting for more patches.

View answer
Network statistics on Linux
1 votes

Are you familiar with sar? You can try sar -n ALL to get all possible network statistics, or if you want rx and tx statistics per network device, every second - try this: sar -n DEV 1 For a 5 ...

View answer
Determining the exit status of the "return" built-in
4 votes

What you're doing is calling a shell command return which doesn't make sense. In general, return with no value followed returns the exit status of the last command executed. From man: Causes a ...

View answer
Find a directory created today
0 votes

find / -newerct ` date +"%D"` -name cy This find cy that was changed (or created) after midnight. the newerXY params: c = change time of the file(you can also try 'B', for birth time but it's not ...

View answer
How to change my script to replace and add new variable in a configuration?
1 votes

Few comments about your code: If you want to easily insert configuration from "replacements" if it doesn't exist, consider iterating each "replacement" over the lines of the file instead of each ...

View answer
ls content of a directory ignoring symlinks
-2 votes

Try this one: ls | grep -v " -> "

View answer
How to cut everything until a specific word / after a find in a script
0 votes

this can be done with echo ${str##*/} which will trim the string from left to right until last '/' > str=/home/user/logfilesError/gandalf_123.log > echo ${str##*/} gandalf_123.log

View answer
searching multiple strings in multiple files inside a directory and printing the string and corresponding file name where it was found
0 votes

use egrep: egrep -n "str1|str2|str3" file_names -n will print line number in the specific file the string was found

View answer