12 tags on


  • All Sites

0 answers

How to add a word at the first of every lines?

File1: Data will be inserted on Thursday Messages has been sent at 6pm Office hours is from 9am to 6pm All the employees are present Output what I want: DMS Data will be inserted on ...

1 answer

Show nth occurrence of a record

Using awk, how to show the nth occurrence of a record and delete the other occurrence, for example" Input File: 79933,2 79933,4 79933,5 55251,1 49494,4 49494,2 49494,2 49494,1 in this example, ...

5 answers

How to edit multiple text files with a single command?

I want to remove the first line of multiple text files and replace it with another line. Is there a way to do this using the terminal? I know how to use vim, is there a way to automate it with it? I ...

6 answers

How can I decode a base64 string from the command line?

I would like to write a bash script to decode a base64 string. For example I type decode QWxhZGRpbjpvcGVuIHNlc2FtZQ== and it prints Aladdin:open sesame and returns to the prompt. So far I have tried ...

6 answers | 1 hour ago by d3vid on Ask Ubuntu
0 answers

Dropbox downloaded zip contains same foldernames twice

I'm not sure if this is a Ubuntu related question. The problem: when I download a folder from dropbox, the files are spread over folders with basically the same name except for the folder name ...

1 answer

Bash, arithmetic expression + bc

I have small problem with use bc command in unix. I have two varaibles: variable1, variable2. The arithmetic expression looks like: res=$$((($variable1*10)/$variable2) I would like to round the ...

1 answers | 1 hour ago by profiler on Stack Overflow
0 answers

A cron job to change file permisssion

when i run chmod 777 to change permission of a file manually it runs. but when i put it in a cron job, it never changes the permission. #!/bin/bash YESTERDAY=`TZ=aaa24 date +%Y-%m-%d` chmod 777 ...

2 answers

How to search all matching previous commands using ctrl+R in Linux

I was looking for the method of listing all the previous commands matching to a particular input. e.g. I am in the following working directory [root@kayan /home]# Now I am looking for a previous ...

2 answers | 1 hour ago by Kayan on Stack Overflow
1 answer

How can I figure out the program that caused core dump?

I'm on Mac OS X 10.10. I notice that my hard-disk is filling up because every few minutes a new core dump file appears in /cores: $ ls -alhtr /cores total 3551488 -rw-r--r--@ 1 saqib admin 6.0K ...

1 answers | 1 hour ago by Saqib Ali on Stack Overflow
2 answers

How to remove files using find and rm command?

find -mmin -19 -exec rm '{}'\; It will find the modified files 1st and then remove them. but it gives me error as below, find: missing argument to `-exec' Also tried various combinations like, ...

2 answers | 2 hours ago by Prafulla Kamble on Stack Overflow
2 answers

Parameter expansion

I am trying the following code in shell for Parameter Expansion #!/bin/sh count echo ${count:-60} echo ${count:=120} echo $count echo ${count:+80} x = 'The host name is google' echo ${#x} Output ...

2 answers | 2 hours ago by ChandraSPola on Stack Overflow
1 answer

Format sar samples live with paste and awk

I'm combining live sar samples with paste and trying to format the output with awk live. It works as expected to format the output, but it doesn't do the formatting live on each sample and instead ...

1 answers | 2 hours ago by JacobN on Unix & Linux
1 answer

Parse /proc/mounts and substitude only one field

I am looking for a way to print informations from /proc/mounts like that: /home /dev/md9 /dev/mapper/home home /var/tmp /dev/md7 /dev/mapper/vartmp vartmp I try: awk '{ print $2 " " ...

1 answers | 2 hours ago by Moker on Stack Overflow
0 answers

Ubuntu software centre cannot Install anything again

I used to install using my ubuntu software centre, but sometimes last year, it stopped working, now it shows "use this source" instead of the install button. I have tried every method I've seen here, ...

1 answer

Dynamic Switching of WiFi using a shell program in Raspberry Pi / Ubuntu / Debian

How can I check in a shell script, whether the system is connected to WiFi-1 and if not connected, connect to WiFi-2? I tried using wpa_supplicant and interfaces configurations, but not working as ...

26 answers

Check whether a file exists using Python

How do I check whether a file exists, using Python, without using a try statement?

26 answers | 6 hours ago by spence91 on Stack Overflow
1 answer

bash script - checking multiple worker processes

I want to check multiple processes (have similar name) running or not, using this bash script. Processes names follwo a particular convention where X is a serial number have value 1 to 4. I ...

1 answers | 7 hours ago by JVK on Stack Overflow
3 answers

Why do awk split() make first field to be last element in array?

I'm probably missing something really simple here, but when I say echo 'The quick brown fox jumped over the lazy dog.' | \ awk '{ split($0, WORDS, " "); for ( WORD in WORDS ) { ...

3 answers | 8 hours ago by Rhymoid on Unix & Linux
0 answers

Recording shell output for interactive commands

While looking into a shell redirection problem, I found a couple of answers that pointed me to the script command. As I understand it, script just records in- and output of the terminal, and allows me ...

2 answers

Use gawk to convert from human readable time in a file to unix time?

I am new to gawk. Based on this thread, I already made a gawk function to convert datetime such as "07,JUN,2015,06,PM" to unix time (millisecond): $ cat tst.awk function cvttime(t, a) { ...

2 answers | 9 hours ago by lys1030 on Stack Overflow
1 answer

laravel 4 cannot get phpunit testing to work

I'v installed phpunit by adding it into my composer.js and running the update. The composer did it's thing and automatically installed phpunit and updated various scripts. I then ran the 'phpunit' ...

1 answer

How can I get write access to my usb drives?

I have trouble writing to external drives. They are monuted automatically in Nautilus, but I can not copy anything there ('Paste' and 'create Folder' are just greyed out). Does Anyone have ideas what ...

1 answer

ls and vim color on SunOS 5.8/Solaris 8

I want to use ls and vim with color on Sunos 5.8 SunOS 5.8 Generic_117350-11 sun4u sparc SUNW,Sun-Blade-2500 I have installed ls (GNU coreutils) 6.9 and vim 7.2 In ~/.cshrc: setenv TERM sun-color ...

1 answers | 10 hours ago by Byrne Young on Unix & Linux
0 answers

Twisted Conch MockSSH: implement 'stty -echo'

I am attempting to set up a mock ssh shell server using MockSSH. To test the particular application I'm dealing with, I need to be able to stop the shell from echoing input. The application always ...

2 answers

date. hwclock keep showing wrongly everytime after reboot

Edited question to better reflect situation. (My hwclock and date is not showing correctly) I am on +GMT 8 and i have set my hwclock to localtimezone by doing the following rm /etc/adjtime ...

2 answers | 12 hours ago by Noob on Super User
6 answers

Mount encrypted volumes from command line?

If I have an encrypted external disk (or an internal disk that is not in fstab), I see an entry for it in Nautilus -- with an entry like "X GB Encrypted Volume". I can click on this volume, and am ...

6 answers | 12 hours ago by cha on Ask Ubuntu
1 answer

How to detect EOF on a SOCK_DGRAM socketpair

I'm trying to detect EOF on the endpoint of a socketpair of type SOCK_DGRAM but select never returns: let (sock1, sock2) = Unix.socketpair Unix.PF_UNIX Unix.SOCK_DGRAM 0 let () = Unix.shutdown sock1 ...

3 answers

Get last set of non-empty lines

I'm running a cron job which should get only the last result of iostat -d 1 2. This requires some parsing: What is the simplest way to get the last set of non-empty lines from standard input to ...

3 answers | 13 hours ago by l0b0 on Unix & Linux
3 answers

What's the fatest way to calculate in command line?

Is there a faster way to calculate in command line the following: echo "4 * 5" | bc

3 answers | 13 hours ago by Texom512 on Super User
1 answer

CD with redirect to logger does not work

On Linux, the following cd works fine so cds into tmp: / # cd /tmp tmp # But this does not work (stays at root, nothing appears in /var/log/messages). Why not? / # cd /tmp 2>&1 | ...

1 answers | 13 hours ago by jos on Unix & Linux
15 30 50 per page
1 2 3